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 CatRelax
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.
Jump to solution
11 Replies
Favna
Favna13mo ago
Sapphire Framework
Globally configuring guildIds | Sapphire
Previously at Registering Chat Input Commands - guildIds we covered how to register single commands
ITOH
ITOH13mo ago
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.
Favna
Favna13mo ago
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
ITOH
ITOH13mo ago
How would I create the command in a guild using that though ThinkFrog should I add the guild id to guildIdsToFetch and then sapphire does the rest?
Solution
Favna
Favna13mo ago
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.
Favna
Favna13mo ago
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
ITOH
ITOH13mo ago
I just have so many commands, that 100 global commands are not enough CatBlush okay, well thank you! I will look into more options and maybe I can find a better solution 02laugh
Favna
Favna13mo ago
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.
ITOH
ITOH13mo ago
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 sadge
Sawako
Sawako12mo ago
Discord lies The character limit prevents that from being real
Favna
Favna12mo ago
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 omegalul 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.
Want results from more Discord servers?
Add your server