Releases: ms7m/dispike
v1.0.0b
New Features
-
Support for "Application Command Interaction Data Resolved Structure".
-
Added
.lookup_resolved_member
,.lookup_resolved_user
,.lookup_resolved_channel
,.lookup_resolved_role
methods toIncomingDiscordInteraction
. (closes #55) -
Added
Role
,PartialChannel
,PartialMember
models. -
Added
PerCommandRegistrationSettings
object. This object is required to register commands located inside aEventCollection
. -
Added
on
function 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
EventCollection
to 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)
PermissionsGenerator
is 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.on
has been deprecated. Please usebot.on
instead ordispike.interactions.on
. -
EventHandler
class has been removed, most of the functions have been implemented insideDispike
-
The following commands now will raise an
DiscordAPIError
if the Discord API returns an unexpected status code.set_command_permission
async_set_command_permission
async_get_command_permission_in_guild
async_get_all_command_permissions_in_guild
get_all_command_permissions_in_guild
get_command_permission_in_guild
-
Bot Tokens are no longer required to initialize a
Dispike
object.. 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.InvalidDiscordResponse
for certain combinations of values. (closes #50) -
Added
default_permission
toDiscordCommand
.. Learn more here. This value is set toTrue
by default. (closes #53) -
Accessing methods such as
.lookup_resolved_channel
inIncomingDiscordInteraction
with no resolved structures will now raisedispike.errors.response.NoResolvedInteractions
. -
CommandTypes
has been changed toOptionTypes
. A new class of actual command types has been added. (thanks @mrshmllow) -
IncomingDiscordOptionList
changed toIncomingDiscordSlashData
to better match what it actually is. (thanks @mrshmllow) -
IncomingDiscordInteraction
changed toIncomingDiscordSlashInteraction
(thanks @mrshmllow) -
DiscordCommand
now takes a type which defaults toCommandTypes.SLASH
(AKA Type 1) (thanks @mrshmllow) -
DiscordCommand
now validates that slash commands contain a description. (thanks @mrshmllow) -
DiscordCommand
now validates that context commands (Currently onlyMESSAGE
,USER
) do not have a description or options. (thanks @mrshmllow) -
New events: (thanks @mrshmllow)
MESSAGE_COMMAND
USER_COMMAND
-
New WIP classes
Message
andMessageAttachment
. Discord says they will add attachments as a option type in the future. (thanks @mrshmllow) -
New
IncomingInteraction
ctx classesIncomingDiscordUserCommandInteraction
andIncomingDiscordMessageCommandInteraction
(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.
UserWarnings
andDeprecationWarnings
will now appear on certain deprecated functions.- Passing
middleware_testing_skip_verification_key_request
to Dispike will now disable the request verifier inDiscordVerificationMiddleware
. (If you are usingDiscordVerificationMiddleware
in another starlette-based application, you can passtesting_skip_verification_of_key
to 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_callbacks
on Dispike. - All functions from
EventHandler
have 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_commands
and.delete_commands
now can accept anIncomingApplicationCommand
for argumentcommand_id
.