Client or message undefined

I'm currently trying to code a bot that does the following: - Awaits slash command, executes the corresponding command file - File displays entered data in an embed - User presses a button either to edit provided or add missing info. The problem is that (as far as I understood), you need a collector to handle it. The guide lists the following command: const collector = message.createMessageComponentCollector({ componentType: ComponentType.Button, time: 15000 }); However, I'm not sure what to replace the message object with in this case. Replacing it with interaction seems to cause an error. A couple hours ago, I had the same problem with client, where I wanted to use the bot's profile picture in the slash command, but it claimed that client isn't defined. The answer I received back then was that "client's available even in command files", but it doesn't seem to be the case. How can I access - the bot itself - the bot's embed message for button interactions from a commands/foo.js file?
12 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Luca | LeCarbonator
more specifically, when I refer to a command file, I refer to
module.exports = {
data: new SlashCommandBuilder() ... ,
async execute(interaction) {
// this here!
}
}
module.exports = {
data: new SlashCommandBuilder() ... ,
async execute(interaction) {
// this here!
}
}
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Luca | LeCarbonator
no, I want a collector to respond to buttons that a slash command created
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Luca | LeCarbonator
so I'm not sure how to access the bot's reply if the reply was sent through an interaction method
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Luca | LeCarbonator
oh, it returns a message object?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Luca | LeCarbonator
great! that worked! thank you @vunsh That only leaves the problem of undefined client, then
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Luca | LeCarbonator
thanks! it worked.
Want results from more Discord servers?
Add your server