Responders
Understand how the Responder class works
A classe Responder
é poderosa para lidar com diferentes tipos de interações do discord. Com ela podemos responder botões, menus de seleção e modais, ou todos ao mesmo tempo.
Para criar um Responder
é preciso importar a classe e o enum da base
The Responder
class is powerful for handling different discord interaction types. With it we can reply to buttons, select menus and modals, or all at the same time.
To create a Responder
you need to import the class and enum from the base
See a simple example below, let's send a button through a command and respond to it using the Responder
class
This way we are responding to a fixed button component in a message where the customId is ping/button
, so any button that our bot sends that has this customId will be responded to by this function defined in the run
of our Responder
.
Responders
use the interactionCreate
event, which means that even if the bot restarts, if someone uses that button again, it will still be responded to with the defined function. The same applies to select menus and modals