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 toolkit5mo 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
kvdo
kvdoOP5mo ago
discord.js is 14.16.3 node is 20.17.0
d.js docs
d.js docs5mo ago
:method: SlashCommandBuilder#setContexts() @1.9.0 Sets the contexts of this command.
Mark
Mark5mo ago
use the InteractionContextType.BotDM context
kvdo
kvdoOP5mo ago
Would I be able to do BotDM, Guild, and Private Channel or am I only able to pick one?
kvdo
kvdoOP5mo ago
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
Mark5mo ago
oh it's PrivateChannel mb, but you can set any or all of them
kvdo
kvdoOP5mo ago
How would I do this?
Mark
Mark5mo ago
by passing the desired ones to the setContexts method
kvdo
kvdoOP5mo ago
Thanks! It works now!

Did you find this page helpful?