Bot in GC

How do I get my bot to work within both servers and group chats? It was working before but after I changed smth (I forget what) it's slash commands don't work in dms or group chats anymore
10 Replies
d.js toolkit
d.js toolkit2mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Một Con Vịt 🐤
discord.js is 14.16.3 node is 20.17.0
d.js docs
d.js docs2mo ago
:method: SlashCommandBuilder#setContexts() @1.9.0 Sets the contexts of this command.
Mark
Mark2mo ago
use the InteractionContextType.BotDM context
Một Con Vịt 🐤
Would I be able to do BotDM, Guild, and Private Channel or am I only able to pick one?
Một Con Vịt 🐤
discord.js
discord.js
discord.js is a powerful Node.js module that allows you to interact with the Discord API very easily. It takes a much more object-oriented approach than most other JS Discord libraries, making your bot's code significantly tidier and easier to comprehend.
Mark
Mark2mo ago
oh it's PrivateChannel mb, but you can set any or all of them
Một Con Vịt 🐤
How would I do this?
Mark
Mark2mo ago
by passing the desired ones to the setContexts method
Một Con Vịt 🐤
Thanks! It works now!

Did you find this page helpful?