ButtonInteraction class
constructor
The constructor requires two arguments. The first argument is the data of the button interaction and must be an instance of the Discord.js ButtonInteraction class. The second argument is the addon where to create the button interaction for and must be an instance of the Zyno Bot Addons Addon class.
Properties
type
In case of a ButtonInteraction, the value will be Button
. It defines the type of interaction.
guild
An instance of the Guild class which represents the guild where the interaction took place.
guildId
The id of the guild where the interaction took place.
channel
An instance of the TextChannel, VoiceChannel, StageChannel, DirectoryChannel, ForumChannel, ThreadChannel or DMChannel and represents the channel where the interaction took place.
channelId
The id of the channel where the interaction took place.
member
An instance of the Member class and represents the member who created the interaction.
memberId
The id of the member who created the interaction.
user
An instance of the User class and represents the user who created the interaction.
message
An instance of the Message class and represents the message where the interaction was created.
messageId
The id of the corresponding message of the button interaction.
customId
The id which was given to the button when it was created to recognize it when an interaction with this button was created.
id
The id of the interaction given by Discord.
Functions
isButton
Returns a boolean which defines whether the interaction is a button interaction or not.
isMenu
Returns a boolean which defines whether the interaction is a menu interaction or not.
isForm
Returns a boolean which defines whether the interaction is a form interaction or not.
deferUpdate
Tells the Discord API that a change has already been made and the interaction can be ignored. The function returns a Promise
which gets fulfilled once the update has been deferred.
deferReply
Tells the Discord API that a change will be made, but that it may take a little more time than the Discord API gives by default. The function returns a Promise
which gets fulfilled once the reply has been deferred.
deleteReply
Deletes a previously made reply for the interaction. The function returns a Promise
which gets fulfilled once the reply has been deleted.
reply
Creates a reply for the interaction and sends it as a message. The function returns a Promise
which returns an instance of the Message class which represents the reply which was sent by the bot when the reply was sent.
The object of the reply may contain the following information:
content
: A string of the content of the reply.embeds
: An array with the Embed class.files
: An array with a string which represents a file url or an object when uploading a file.components
: An array with the Discord.js ActionRowBuilder class.
The file object data may contain the following information:
name
: The name of the file you want to uploadattachment
: The path of the file you want to uploaddescription
: The description of the file
followUp
Creates a reply to a previously made reply for the interaction and sends it as a message. The function returns a Promise
which returns an instance of the Message class which represents the message of the follow up which was sent by the bot when the follow up was sent.
The object of the follow up may contain the following information:
content
: A string of the content of the follow up.embeds
: An array with the Embed class.files
: An array with a string which represents a file url or an object when uploading a file.components
: An array with the Discord.js ActionRowBuilder class.
The file object data may contain the following information:
name
: The name of the file you want to uploadattachment
: The path of the file you want to uploaddescription
: The description of the file
update
Updates a previously made reply for the interaction and sends it as a message. The function returns a Promise
which returns an instance of the Message class which represents the mew reply which was sent by the bot when the reply was updated.
The object of the reply may contain the following information:
content
: A string of the content of the message.embeds
: An array with the Embed class.files
: An array with a string which represents a file url or an object when uploading a file.components
: An array with the Discord.js ActionRowBuilder class.
The file object data may contain the following information:
name
: The name of the file you want to uploadattachment
: The path of the file you want to uploaddescription
: The description of the file
sendForm
Sends a form to the member who created an interaction. Once the form has been submitted, the data can be received with the formSubmit event of the createEventListener() EventEmitter.
executeCommand
Executes another registered command based on the interaction executed by the member. The command can be a default Zyno Bot command or another command created by another addon.
Last updated