Discord-ext-slash

Latest version: v0.9.2

Safety actively analyzes 681914 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 6

0.8.1

Removed Stuff
* `Command.default` and `Group.default` were never implemented and are now no longer documented. Goodbye.

Fixes
* `CallbackFlags` is now `IntFlag`, instead of `IntEnum`.

0.8.0

New Stuff
* `ApplicationCommandOptionType.MENTIONABLE` works effectively as a union of `USER` and `ROLE`; the logic will attempt to resolve `MENTIONABLE` IDs as users first, then as roles.
* `ApplicationCommandOptionType.NUMBER` is the `float` analog of `INTEGER`

Breaking Changes
* `InteractionResponseType.Acknowledge` and `InteractionResponseType.ChannelMessage` are now fully removed from the library.
Potentially Breaking Changes
* `MessageFlags` is renamed to `CallbackFlags` following API docs renaming. The old name remains as an alias, but it will not be imported in a `from discord.ext.slash import *` context so code that uses both that import and the old name will fail with a `NameError`.
* All `MessageFlags` that were read-only are now gone in `CallbackFlags`. `CallbackFlags.EPHEMERAL` is currently the only enum of that type.

Changes
* Remaining `InteractionResponseType` enum names are now listed in API docs in `CONSTANT_CASE`, so the enums gain these as aliases.

0.7.0

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.

0.6.2

Fixes
* Fixed an edge case where removing all commands from a guild in code would not do the same on the API, causing ghost commands that would fail with a command-not-found error.

0.6.1

New Stuff
* `Client.register_commands` is now public. Upon awaiting, it calls the API to sync the locally registered commands. If `guild_id` is specified, only commands specific to that guild will be processed. (Useful if you dynamically register guild-specific commands - once your hijinks are done, call `register_commands` with the guild ID.)

Fixes
* `Command.check` now properly returns the coroutine, so you can apply the same check coroutine to multiple commands by stacking the decorators.

0.6.0

New Stuff
* `Context.bot` is an alias for `Context.client`
* `file` can now be passed in `Context.respond` in the same way as `Messageable.send`
* `ephemeral` in `Context.respond` shortcuts `flags=MessageFlags.EPHEMERAL`
* `deferred` in `Context.respond` shortcuts `rtype=InteractionResponseType.DeferredChannelMessageWithSource`

Fixes
* `guild_id` in `Command` kwargs was actually `guild`. Now both are acceptable
* Falling back to finding command by name and guild ID never worked because guild ID was being checked as a string

Page 2 of 6

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.