This repository was archived by the owner on Feb 3, 2025. It is now read-only.
Releases: Kenny2github/discord-ext-slash
Releases · Kenny2github/discord-ext-slash
1.0.0b3
Changes
BaseContext.respondnow has slightly different semantics:- Passing a value of
Noneas an argument leads to that parameter not being sent to the API. This has always been the case for all parameters exceptcontent, which used to cast theNoneto a string. - Passing a falsy value that is not
None(e.g.embeds=[]) now sends the empty value to the API. You are responsible for making sure that at least one value is not empty (client-side validation only ensures one is passed).
- Passing a value of
Fixes
- Calls of the form
BaseContext.respond(embed=...)(i.e. onlyembedis passed) work again now. - Multiple responses to the same interaction now actually edits the response again.
1.0.0b2
Fixes
- Commands in DMs were still potentially failing. This should fix it.
1.0.0b1
New Stuff
- Message components! See the demo bot for an example, because it's 8:25 AM, I haven't slept, and I'm not listing all of the classes that got added.
Breaking Changes
InteractionCallbackTypeenum names are nowCONSTANT_CASEonly; theCamelCasealiases have been removed.
Potentially Breaking Changes
InteractionResponseTypeis renamed toInteractionCallbackTypefollowing API docs renaming. The old name remains as an alias, but it will not be imported in afrom discord.ext.slash import *context so code that uses both that import and the old name will fail with aNameError.Context.authorcan now be adiscord.Userinstead of adiscord.Memberif the command is run in DMs.
0.9.2
0.9.1
0.9.0
New Stuff
- Support
channel_types(note that the constructor arguments differ from the attribute), to specify type of channel for aCHANNEL-type option. - Support
min_valueandmax_value, to constrain numeric option values. - Use
ChoiceEnumas a shortcut forOptions withChoices. Best demonstrated by example.
0.8.1
Removed Stuff
Command.defaultandGroup.defaultwere never implemented and are now no longer documented. Goodbye.
Fixes
CallbackFlagsis nowIntFlag, instead ofIntEnum.
0.8.0
New Stuff
ApplicationCommandOptionType.MENTIONABLEworks effectively as a union ofUSERandROLE; the logic will attempt to resolveMENTIONABLEIDs as users first, then as roles.ApplicationCommandOptionType.NUMBERis thefloatanalog ofINTEGER
Breaking Changes
InteractionResponseType.AcknowledgeandInteractionResponseType.ChannelMessageare now fully removed from the library.
Potentially Breaking Changes
MessageFlagsis renamed toCallbackFlagsfollowing API docs renaming. The old name remains as an alias, but it will not be imported in afrom discord.ext.slash import *context so code that uses both that import and the old name will fail with aNameError.- All
MessageFlagsthat were read-only are now gone inCallbackFlags.CallbackFlags.EPHEMERALis currently the only enum of that type.
Changes
- Remaining
InteractionResponseTypeenum names are now listed in API docs inCONSTANT_CASE, so the enums gain these as aliases.
0.7.0
New Stuff
Permissions! #5 discord/discord-api-docs#2737 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_permis probably the main mechanism for setting permissions.add_perm(target, perm)infers the target guild ID and type of target from thetarget.guild.idandisinstance(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_permissionsregisters 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_permissionsis dispatched once immediately after the initialregister_commandsand by default just callsregister_permissions. Override this with@client.eventand useadd_permto register permissions before finally callingregister_permissionsat the end of the event handler to set permissions dynamically. - New decorator:
@slash.permitis a shortcut toCommand.add_perm. Probably best used with static things like owner IDs. - New attribute:
Command.permissionsis aCommandPermissionsDictthat keeps track of all permissions for this command. - New enum:
ApplicationCommandPermissionTypeindicates role or user permissions.
Changes
/namesindemo_bot.pyuses an embed in an ephemeral response to show that they can be used there now./stopin same file useson_slash_permissionsandadd_permto demonstrate them, replacing thecheck_ownercheck.
Fixes
PartialObjectis annotated as having aguildattribute that is adiscord.Object.SlashBotis annotated as having itsslash: 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.