Skip to content
Discussion options

You must be logged in to vote

There are many examples here you can follow:

https://github.com/Rapptz/discord.py/tree/master/examples/views

The tic_tac_toe example shows an organized way of creating a Button subclass with a callback and adding them dynamically to the view in the constructor.

Note that the button callback actually receives the button, so you can check its label, custom_id, or other attributes in the callback.

When using the decorator, button comes after the interaction. When constructing a button using Button class, the self parameter is the button.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jbaumgarten
Comment options

@jbaumgarten
Comment options

Answer selected by jbaumgarten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants