serenity-rs / poise

Discord bot command framework for serenity, with advanced features like edit tracking and flexible argument parsing
MIT License
678 stars 117 forks source link

Allow automatic registration of guild-specific commands #103

Closed dacid44 closed 2 years ago

dacid44 commented 2 years ago

This is a pretty useful thing to have for developing a bot. If it exists in this library, I haven't found it. The main crate doc page mentions the differences between local and global commands, but I haven't found a way to register guild-specific commands other than manually going through the register_application_commands_buttons() dialog.

Please let me know if I'm missing something or misunderstanding this.

Thanks!

kangalio commented 2 years ago

It is possible with https://docs.rs/poise/latest/poise/builtins/fn.create_application_commands.html although I should mention that in the slash command paragraph of the root docs yeah

dacid44 commented 2 years ago

Yeah, I see now that you would specify a guild in https://docs.rs/serenity/latest/serenity/model/application/command/struct.Command.html. Based on my (very limited) experience so far, it might be really helpful to have a docs section on at least the broad-strokes ways that poise interacts with serenity, such as in this case using serenity's Command struct to register slash commands (in addition to the brief intro to serenity that's already there).

Edit: never mind, looks like that's actually done using serenity::model::guild::set_application_commands().

kangalio commented 2 years ago

Added more docs in aec7b5cd4229a078a0629a314470c4ac8667b074