Skip to content

Releases: ms7m/dispike

v1.0.0b

10 Sep 03:58
b2cba22
Compare
Choose a tag to compare

New Features

  • Support for "Application Command Interaction Data Resolved Structure".

  • Added .lookup_resolved_member, .lookup_resolved_user, .lookup_resolved_channel, .lookup_resolved_role methods to IncomingDiscordInteraction. (closes #55)

  • Added Role, PartialChannel, PartialMember models.

  • Added PerCommandRegistrationSettings object. This object is required to register commands located inside a EventCollection.

  • Added on function to dispike.interactions. If you do not wish to use an EventCollection, 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 a NewApplicationPermission. You can import it from dispike.helpers
  • Added a class for Deferred Empherical Responses. It is located in dispike.resposnes. Functionality is identical to DeferredResponse.

Breaking Changes

  • 🚨 Modules, classes and other items have been reorganized!. Please read the changes on #52!

  • bot.interactions.on has been deprecated. Please use bot.on instead or dispike.interactions.on.

  • EventHandler class has been removed, most of the functions have been implemented inside Dispike

  • 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 to DiscordCommand.. Learn more here. This value is set to True by default. (closes #53)

  • Accessing methods such as .lookup_resolved_channel in IncomingDiscordInteraction with no resolved structures will now raise dispike.errors.response.NoResolvedInteractions.

  • CommandTypes has been changed to OptionTypes. A new class of actual command types has been added. (thanks @mrshmllow)

  • IncomingDiscordOptionList changed to IncomingDiscordSlashData to better match what it actually is. (thanks @mrshmllow)

  • IncomingDiscordInteraction changed to IncomingDiscordSlashInteraction (thanks @mrshmllow)

  • DiscordCommand now takes a type which defaults to CommandTypes.SLASH (AKA Type 1) (thanks @mrshmllow)

  • DiscordCommand now validates that slash commands contain a description. (thanks @mrshmllow)

  • DiscordCommand now validates that context commands (Currently only MESSAGE, USER) do not have a description or options. (thanks @mrshmllow)

  • New events: (thanks @mrshmllow)

    • MESSAGE_COMMAND
    • USER_COMMAND
  • New WIP classes Message and MessageAttachment. Discord says they will add attachments as a option type in the future. (thanks @mrshmllow)

  • New IncomingInteraction ctx classes IncomingDiscordUserCommandInteraction and IncomingDiscordMessageCommandInteraction (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 and DeprecationWarnings will now appear on certain deprecated functions.
  • Passing middleware_testing_skip_verification_key_request to Dispike will now disable the request verifier in DiscordVerificationMiddleware. (If you are using DiscordVerificationMiddleware in another starlette-based application, you can pass testing_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 an IncomingApplicationCommand for argument command_id.