Preventing Commands in DMs
How do you prevent commands from being used in DMs? Message commands.
Solution:Jump to solution
Add
runIn: 'GUILD_ANY'
to your command options. This will only the command to be run in guild channels. If you want to specify a type of channel there are opttions for that13 Replies
I'd like to avoid using preconditions if possible
Solution
Add
runIn: 'GUILD_ANY'
to your command options. This will only the command to be run in guild channels. If you want to specify a type of channel there are opttions for thatBecause that would be a hassle
Okay
Technically that is using a precondition btw. Its just one of the premade ones that come with sapphire.
Ok
yeah uh
kinda still fucks up stuff in dms with the bot
You're gonna need to be more specific than that. Whats the problem?
when ever the command is still ran in DMs, it still crashes it even when that’s added
Thats odd. Is your code on github?
no it’s closed source
the repo for it is private but I can show an example
Can you reproduce it in a small bot and share the code for that?
sure
once I get this done rq
or it could also be a chance of discord.js changes
since I’m on v14
wait nvm
I’ll just add an check to the preconditions
or use ‘GuildOnly’ in preconditions: []
yea using
preconditions: ['GuildOnly', 'PreconditionName']
works for me