discord.py
discord.py copied to clipboard
[commands] Add guild(s) kwarg to BotBase.add_command and correct BotBase.add_cog doc
Summary
Fixes #9366
This PR adds the following kwargs to Bot.add_command
: guild
and guilds
for hybrid app commands. This allows defining guilds for a hybrid app command while adding it to the bot, these are also used by the lib in BotBase.add_cog
if any guild(s) were passed to that.
This PR also corrects the doc of the guild(s)
kwargs in BotBase.add_cog
which previously led users to believe that the kwargs are only valid for GroupCog/app_commands.Group which is not the case.
This can be a breaking change since previously hybrid app commands in cogs were not added as guild commands when the guild kwargs in add_cog were used. This could lead to unexpected behaviour.
I have not tested all possibilities/edge cases(if any) with the new kwargs for add_command.
Checklist
- [x] If code changes were made then they have been tested.
- [x] I have updated the documentation to reflect the changes.
- [x] This PR fixes an issue.
- [x] This PR adds something new (e.g. new method or parameters).
- [x] This PR is a breaking change (e.g. methods or parameters removed/renamed)
- [ ] This PR is not a code change (e.g. documentation, README, ...)