Infinite parameters for slash commands
Introduction
I have a chat moderation bot that uses command parameters to clean channels of certain content. The main appeal of my bot though is that you can pair multiple parameters together for more moderation control and with the addition of slash commands to discords API I would like to propose the option to provide parameters infinitely in a single command, much like how some bots (mine included) did before now.
Details & Examples
This isn't by any means something new to bots since quite a few have been doing these parameter pairings before, the only difference now is that with the new slash commands you can only provide a single sub-command group and sub-command making parameter pairing near impossible.
Here is an example command of how my bot handles this parameter pairing:
.cleanup @exampleUser text "hello"
This would delete any messages from a user that contains the text "hello".
The different parameters are: The user mention, text and the message content.
Currently though if using slash commands you can only provide one of these parameters.
Conclusion
I'm sure this is already a planned feature of the discord developers, but I figured at least bringing it to the attention of the community might get some other bot developers excited about the possibilities this could lead too and might show the discord developers how much something like this would be useful to bot developers.
Kindest Regards <3
-
You may have already figured this out but each command or subcommand supports up to 10 arguments or parameters.
So for example your cleanup command would be registered like this:
{
name: 'cleanup',
description: 'deletes messages with a given string by a given user',
options: [
{
name: 'user'
description: 'the user whose messages will be deleted',
type: 6,
required: true
},
{
name: 'text'
description: 'messages with this text will be deleted',
type: 3,
required: true
}
]
}1
Please sign in to leave a comment.
Comments
1 comment