New Stuff
Permissions! 5 discord/discord-api-docs2737 Documentation coming soon, but here's an overview:
* New attribute: `Command.default_permission` (settable in kwargs) determines whether the command is enabled for all users by default.
* New method: `Command.add_perm` is probably the main mechanism for setting permissions. `add_perm(target, perm)` infers the target guild ID and type of target from the `target.guild.id` and `isinstance(target, ...)` respectively; `add_perm(target, perm, None)` sets the perm as the default for *all* guilds; `add_perm(discord.Object(id), perm, guild, type)` lets you set the perm by ID alone, but you have to provide guild and type information.
* New method: `SlashBot.register_permissions` registers locally set permissions with the API. Calling with a guild ID will set **permissions** for that guild (which can span commands outside it).
* New event: `on_slash_permissions` is dispatched once immediately after the initial `register_commands` and by default just calls `register_permissions`. Override this with `client.event` and use `add_perm` to register permissions before finally calling `register_permissions` at the end of the event handler to set permissions dynamically.
* New decorator: `slash.permit` is a shortcut to `Command.add_perm`. Probably best used with static things like owner IDs.
* New attribute: `Command.permissions` is a `CommandPermissionsDict` that keeps track of all permissions for this command.
* New enum: `ApplicationCommandPermissionType` indicates role or user permissions.
Changes
* `/names` in `demo_bot.py` uses an embed in an ephemeral response to show that they can be used there now.
* `/stop` in same file uses `on_slash_permissions` and `add_perm` to demonstrate them, replacing the `check_owner` check.
Fixes
* `PartialObject` is annotated as having a `guild` attribute that is a `discord.Object`.
* `SlashBot` is annotated as having its `slash: Set[Command]` attribute.