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•3y ago
Message Not Public
Sign In & Join Server To View
more specifically, when I refer to a command file, I refer to
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
no, I want a collector to respond to buttons that a slash command created
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
so I'm not sure how to access the bot's reply if the reply was sent through an interaction method
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
oh, it returns a message object?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
great! that worked! thank you @vunsh
That only leaves the problem of undefined client, then
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
thanks! it worked.