Sample implementation of per-subcommand preconditions

Hello! Are there any examples on how would I be able to implement the new feature? And I suppose this supports both interaction and message preconditions? And would this be a better option instead of using precondition decorators? Thank you!
4 Replies
Dolliwyx
DolliwyxOP16mo ago
Thank you!! Additional question, should I have a command with subcommands, and I'd like a certain command to only run in DMs but the rest can run in text channels, how would I be able to achieve this now that run in preconditions are deprecated?
Favna
Favna16mo ago
Add a precondition with
{ name: CommandPreConditions.RunIn, context: { types: [ChannelType.DM] } }
{ name: CommandPreConditions.RunIn, context: { types: [ChannelType.DM] } }
(And adjust types as necessary)
Dolliwyx
DolliwyxOP16mo ago
I see! Cool stuff, thank you!
Want results from more Discord servers?
Add your server