New Features
-
Support for "Application Command Interaction Data Resolved Structure".
-
Added
.lookup_resolved_member,.lookup_resolved_user,.lookup_resolved_channel,.lookup_resolved_rolemethods toIncomingDiscordInteraction. (closes #55) -
Added
Role,PartialChannel,PartialMembermodels. -
Added
PerCommandRegistrationSettingsobject. This object is required to register commands located inside aEventCollection. -
Added
onfunction todispike.interactions. If you do not wish to use anEventCollection, you can use this function and later register it with Dispike by passing the function to.register_event_command. -
Added
EventCollectionto allow for similarly grouped commands to be developed in a single class. Feedback is helpful! #46
class StockTicker(interactions.EventCollection):
@staticmethod
def command_schemas() -> typing.List[
typing.Union[interactions.PerCommandRegistrationSettings, DiscordCommand]
]:
"""Return a list of commands to be registered
"""
return [
interactions.PerCommandRegistrationSettings(
schema=DiscordCommand(
name="...",
description="....",
options=[],
),
guild_id=11111111,
)
]
@interactions.on("....")
async def sample_interactions(*args, **kwargs) -> DiscordResponse:
return DiscordResponse(content="testing")
@interactions.on("....")
async def sample_interactions(*args, **kwargs) -> DiscordResponse:
return DiscordResponse(content="testing")
# register collection
bot = Dispike(...)
bot.register_event_collection(collection=StockTicker(), register_command_with_discord=True)- Support for NUMBER Command Type (closes #48)
PermissionsGeneratoris a helper class to assist you in creating proper permissions for a command. Punch in some arguments and it will spit out aNewApplicationPermission. You can import it fromdispike.helpers- Added a class for Deferred Empherical Responses. It is located in
dispike.resposnes. Functionality is identical toDeferredResponse.
Breaking Changes
-
🚨 Modules, classes and other items have been reorganized!. Please read the changes on #52!
-
bot.interactions.onhas been deprecated. Please usebot.oninstead ordispike.interactions.on. -
EventHandlerclass has been removed, most of the functions have been implemented insideDispike -
The following commands now will raise an
DiscordAPIErrorif the Discord API returns an unexpected status code.set_command_permissionasync_set_command_permissionasync_get_command_permission_in_guildasync_get_all_command_permissions_in_guildget_all_command_permissions_in_guildget_command_permission_in_guild
-
Bot Tokens are no longer required to initialize a
Dispikeobject.. Accessing methods, attributes or functions that require a bot token (such as registering commands) will now raise a new exception:dispike.errors.dispike.BotTokenNotProvided. Certain features are still available without a bot token. Such as sending deferred messages or just responding to interactions. (closes #51) -
DiscordResponse will now raise an exception
dispike.errors.responses.InvalidDiscordResponsefor certain combinations of values. (closes #50) -
Added
default_permissiontoDiscordCommand.. Learn more here. This value is set toTrueby default. (closes #53) -
Accessing methods such as
.lookup_resolved_channelinIncomingDiscordInteractionwith no resolved structures will now raisedispike.errors.response.NoResolvedInteractions. -
CommandTypeshas been changed toOptionTypes. A new class of actual command types has been added. (thanks @mrshmllow) -
IncomingDiscordOptionListchanged toIncomingDiscordSlashDatato better match what it actually is. (thanks @mrshmllow) -
IncomingDiscordInteractionchanged toIncomingDiscordSlashInteraction(thanks @mrshmllow) -
DiscordCommandnow takes a type which defaults toCommandTypes.SLASH(AKA Type 1) (thanks @mrshmllow) -
DiscordCommandnow validates that slash commands contain a description. (thanks @mrshmllow) -
DiscordCommandnow validates that context commands (Currently onlyMESSAGE,USER) do not have a description or options. (thanks @mrshmllow) -
New events: (thanks @mrshmllow)
MESSAGE_COMMANDUSER_COMMAND
-
New WIP classes
MessageandMessageAttachment. Discord says they will add attachments as a option type in the future. (thanks @mrshmllow) -
New
IncomingInteractionctx classesIncomingDiscordUserCommandInteractionandIncomingDiscordMessageCommandInteraction(thanks @mrshmllow)
Misc Fixes, and changes
- 🎉 Dispike is now leaving alpha stage! Thank you to all the contributors who helped out! While things are more stable, this library can still go through sudden breaking changes! Developers are encouraged to keep tabs on this repository and open issues for unexpected behaviors.
UserWarningsandDeprecationWarningswill now appear on certain deprecated functions.- Passing
middleware_testing_skip_verification_key_requestto Dispike will now disable the request verifier inDiscordVerificationMiddleware. (If you are usingDiscordVerificationMiddlewarein another starlette-based application, you can passtesting_skip_verification_of_keyto the middleware to skip checks). - Command Choices will now accept integers and floats.
- You can now clear callbacks by using the method
clear_all_event_callbackson Dispike. - All functions from
EventHandlerhave been moved to the main dispike object. - Logging to stdout will no longer be default in a future release of Dispike(You will need to pass a parameter
enable_logging) to enable logging. Developers are encouraged to still configure logging through loguru's settings - Dispike will now log any outgoing http requests.
- Tweaks to event name callback determination. (closes #56)
.get_commands,.edit_commandsand.delete_commandsnow can accept anIncomingApplicationCommandfor argumentcommand_id.