Register a command on every guild
Hey,
I am working on a bot, where I need to register some commands on every guild the bot is on. I cannot use global commands in that case. I was not able to find a straight forward in-build way to do that, so I wanted to ask, whether I missed something, or whether I have to implement that manually.
I am still pretty new to sapphire, so if I need to do that manually, would be great if someone could give me food for thought.
PS: Please mention me if you answer, else I might miss it
Solution:Jump to solution
You'll pretty much have to end up handling registering yourself, which these methods make easier than doing it raw through the DiscordJS methods. As opposed to using the
registerApplicationCommands
in the command that is. Then as for how it will help, you can register the commands yourself to the guild in question when you receive a guildAdd event.11 Replies
Sapphire Framework
Globally configuring guildIds | Sapphire
Previously at Registering Chat Input Commands - guildIds we covered how to register single commands
Thanks, but the problem with that one is, that I do not have every guild id I need.
What I mean is, when the bot is added to a new guild, I need it to create all commands there too.
it's part of advanced features that isn't supported OOTB though simple options: https://www.sapphirejs.dev/docs/Guide/commands/application-commands/application-command-registry/advanced/registering-application-commands-outside-a-command
Sapphire Framework
Registering Application Commands outside a Command | Sapphire
You are able to register your application commands inside of their command class, but also outside of the class! Whether
How would I create the command in a guild using that though should I add the guild id to
guildIdsToFetch
and then sapphire does the rest?Solution
You'll pretty much have to end up handling registering yourself, which these methods make easier than doing it raw through the DiscordJS methods. As opposed to using the
registerApplicationCommands
in the command that is. Then as for how it will help, you can register the commands yourself to the guild in question when you receive a guildAdd event.But I can guarantee you it won't be easy and it will be a lot of manual labour but your call if you want to continue with this process
Why do you need to do this btw?
If it's for the sake of monitizing commands, don't forget Discord is on the brink of releasing Bot Premium which is native premium / monetary gated commands
I just have so many commands, that 100 global commands are not enough okay, well thank you! I will look into more options and maybe I can find a better solution
maybe consider groups? you can have over 600 commands if you leverage groups and subcommands. iirc 25 groups and each group can have 25 subcommands or something like that.
Yea, but I still want a considerable UX with the commands, especially their names.
Also a single command can not have more than 4000 characters (name, description, options...). Which is also kind of a bummer
Discord lies
The character limit prevents that from being real
they dont lie. They just have different rules
that's like saying the first law of robotics is a lie in the instance that one human orders a robot to harm another human. That's just actual bullshit case you somehow have been living under a rock since you were shat out of your momma's womb because Isaac Asimov predates you:
1. A robot may not injure a human being or, through inaction, allow a human being to come to harm. 2. A robot must obey the orders given to it by human beings, except where such orders would conflict with the First Law. 3. A robot must protect its own existence as long as such protection does not conflict with the First or Second Laws.