Add support for User and Message commands
This release adds the following:
The new ApplicationCommandType enum
This lets you declare a User or a Message command. For more information about these new types of commands, see the Discord docs.
The syntax is as follows:
@discord.command(name="High Five", type=ApplicationCommandType.USER)
def highFive(ctx, target):
return f"{ctx.author.display_name} wants to say hello to {target.display_name}"
Thank you @fmdaboville for this contribution! (Issue #50, PR #51)
Response
is now Message
To support Message commands, the Response
class is now the Message
class. It is now used to represent incoming messages (from message commands) in addition to outgoing messages (i.e., sent by the bot). It gains some new fields, notably id
, channel_id
, timestamp
, and author
, which are only set for these incoming messages. (PR #52)
The old name (Response
) will still work, but it is officially deprecated and will raise a warning.
Other renaming
In addition, SlashCommand
has become Command
, DiscordInteractions.update_slash_commands
has become update_commands
, etc. Again, the old names still work, but they are deprecated. (PR #52)
Internal reorganization
Internally, models such as the Message, User, Member, and Command classes were reorganized. This shouldn't cause any changes from the user perspective, but it's something to note! (PR #52)