Browse Source

Add intents to event reference

pull/5878/head
Xua 5 years ago
committed by GitHub
parent
commit
1066f42f1f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 76
      docs/api.rst

76
docs/api.rst

@ -262,6 +262,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
If the ``channel`` is a :class:`TextChannel` then the ``user`` parameter If the ``channel`` is a :class:`TextChannel` then the ``user`` parameter
is a :class:`Member`, otherwise it is a :class:`User`. is a :class:`Member`, otherwise it is a :class:`User`.
This requires :attr:`Intents.typing` to be enabled.
:param channel: The location where the typing originated from. :param channel: The location where the typing originated from.
:type channel: :class:`abc.Messageable` :type channel: :class:`abc.Messageable`
:param user: The user that started typing. :param user: The user that started typing.
@ -273,6 +275,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called when a :class:`Message` is created and sent. Called when a :class:`Message` is created and sent.
This requires :attr:`Intents.messages` to be enabled.
.. warning:: .. warning::
Your bot's own messages and private messages are sent through this Your bot's own messages and private messages are sent through this
@ -294,6 +298,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
If this occurs increase the :attr:`Client.max_messages` attribute If this occurs increase the :attr:`Client.max_messages` attribute
or use the :func:`on_raw_message_delete` event instead. or use the :func:`on_raw_message_delete` event instead.
This requires :attr:`Intents.messages` to be enabled.
:param message: The deleted message. :param message: The deleted message.
:type message: :class:`Message` :type message: :class:`Message`
@ -309,6 +315,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
If this occurs increase the :attr:`Client.max_messages` attribute If this occurs increase the :attr:`Client.max_messages` attribute
or use the :func:`on_raw_bulk_message_delete` event instead. or use the :func:`on_raw_bulk_message_delete` event instead.
This requires :attr:`Intents.messages` to be enabled.
:param messages: The messages that have been deleted. :param messages: The messages that have been deleted.
:type messages: List[:class:`Message`] :type messages: List[:class:`Message`]
@ -320,6 +328,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
If the message is found in the message cache, If the message is found in the message cache,
it can be accessed via :attr:`RawMessageDeleteEvent.cached_message` it can be accessed via :attr:`RawMessageDeleteEvent.cached_message`
This requires :attr:`Intents.messages` to be enabled.
:param payload: The raw event payload data. :param payload: The raw event payload data.
:type payload: :class:`RawMessageDeleteEvent` :type payload: :class:`RawMessageDeleteEvent`
@ -331,6 +341,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
If the messages are found in the message cache, If the messages are found in the message cache,
they can be accessed via :attr:`RawBulkMessageDeleteEvent.cached_messages` they can be accessed via :attr:`RawBulkMessageDeleteEvent.cached_messages`
This requires :attr:`Intents.messages` to be enabled.
:param payload: The raw event payload data. :param payload: The raw event payload data.
:type payload: :class:`RawBulkMessageDeleteEvent` :type payload: :class:`RawBulkMessageDeleteEvent`
@ -355,6 +367,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
- The message's embeds were suppressed or unsuppressed. - The message's embeds were suppressed or unsuppressed.
- A call message has received an update to its participants or ending time. - A call message has received an update to its participants or ending time.
This requires :attr:`Intents.messages` to be enabled.
:param before: The previous version of the message. :param before: The previous version of the message.
:type before: :class:`Message` :type before: :class:`Message`
:param after: The current version of the message. :param after: The current version of the message.
@ -376,6 +390,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
denotes an "embed" only edit, which is an edit in which only the embeds are updated by the Discord denotes an "embed" only edit, which is an edit in which only the embeds are updated by the Discord
embed server. embed server.
This requires :attr:`Intents.messages` to be enabled.
:param payload: The raw event payload data. :param payload: The raw event payload data.
:type payload: :class:`RawMessageUpdateEvent` :type payload: :class:`RawMessageUpdateEvent`
@ -389,6 +405,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
To get the :class:`Message` being reacted, access it via :attr:`Reaction.message`. To get the :class:`Message` being reacted, access it via :attr:`Reaction.message`.
This requires :attr:`Intents.reactions` to be enabled.
:param reaction: The current state of the reaction. :param reaction: The current state of the reaction.
:type reaction: :class:`Reaction` :type reaction: :class:`Reaction`
:param user: The user who added the reaction. :param user: The user who added the reaction.
@ -399,6 +417,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called when a message has a reaction added. Unlike :func:`on_reaction_add`, this is Called when a message has a reaction added. Unlike :func:`on_reaction_add`, this is
called regardless of the state of the internal message cache. called regardless of the state of the internal message cache.
This requires :attr:`Intents.reactions` to be enabled.
:param payload: The raw event payload data. :param payload: The raw event payload data.
:type payload: :class:`RawReactionActionEvent` :type payload: :class:`RawReactionActionEvent`
@ -412,6 +432,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
To get the message being reacted, access it via :attr:`Reaction.message`. To get the message being reacted, access it via :attr:`Reaction.message`.
This requires :attr:`Intents.reactions` to be enabled.
:param reaction: The current state of the reaction. :param reaction: The current state of the reaction.
:type reaction: :class:`Reaction` :type reaction: :class:`Reaction`
:param user: The user who added the reaction. :param user: The user who added the reaction.
@ -422,6 +444,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called when a message has a reaction removed. Unlike :func:`on_reaction_remove`, this is Called when a message has a reaction removed. Unlike :func:`on_reaction_remove`, this is
called regardless of the state of the internal message cache. called regardless of the state of the internal message cache.
This requires :attr:`Intents.reactions` to be enabled.
:param payload: The raw event payload data. :param payload: The raw event payload data.
:type payload: :class:`RawReactionActionEvent` :type payload: :class:`RawReactionActionEvent`
@ -431,6 +455,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
if the message is not found in the internal message cache, then this event if the message is not found in the internal message cache, then this event
will not be called. Consider using :func:`on_raw_reaction_clear` instead. will not be called. Consider using :func:`on_raw_reaction_clear` instead.
This requires :attr:`Intents.reactions` to be enabled.
:param message: The message that had its reactions cleared. :param message: The message that had its reactions cleared.
:type message: :class:`Message` :type message: :class:`Message`
:param reactions: The reactions that were removed. :param reactions: The reactions that were removed.
@ -441,6 +467,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called when a message has all its reactions removed. Unlike :func:`on_reaction_clear`, Called when a message has all its reactions removed. Unlike :func:`on_reaction_clear`,
this is called regardless of the state of the internal message cache. this is called regardless of the state of the internal message cache.
This requires :attr:`Intents.reactions` to be enabled.
:param payload: The raw event payload data. :param payload: The raw event payload data.
:type payload: :class:`RawReactionClearEvent` :type payload: :class:`RawReactionClearEvent`
@ -450,6 +478,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
if the message is not found in the internal message cache, then this event if the message is not found in the internal message cache, then this event
will not be called. Consider using :func:`on_raw_reaction_clear_emoji` instead. will not be called. Consider using :func:`on_raw_reaction_clear_emoji` instead.
This requires :attr:`Intents.reactions` to be enabled.
.. versionadded:: 1.3 .. versionadded:: 1.3
:param reaction: The reaction that got cleared. :param reaction: The reaction that got cleared.
@ -460,6 +490,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called when a message has a specific reaction removed from it. Unlike :func:`on_reaction_clear_emoji` this is called Called when a message has a specific reaction removed from it. Unlike :func:`on_reaction_clear_emoji` this is called
regardless of the state of the internal message cache. regardless of the state of the internal message cache.
This requires :attr:`Intents.reactions` to be enabled.
.. versionadded:: 1.3 .. versionadded:: 1.3
:param payload: The raw event payload data. :param payload: The raw event payload data.
@ -470,6 +502,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called whenever a private channel is deleted or created. Called whenever a private channel is deleted or created.
This requires :attr:`Intents.messages` to be enabled.
:param channel: The private channel that got created or deleted. :param channel: The private channel that got created or deleted.
:type channel: :class:`abc.PrivateChannel` :type channel: :class:`abc.PrivateChannel`
@ -477,6 +511,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called whenever a private group DM is updated. e.g. changed name or topic. Called whenever a private group DM is updated. e.g. changed name or topic.
This requires :attr:`Intents.messages` to be enabled.
:param before: The updated group channel's old info. :param before: The updated group channel's old info.
:type before: :class:`GroupChannel` :type before: :class:`GroupChannel`
:param after: The updated group channel's new info. :param after: The updated group channel's new info.
@ -498,6 +534,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Note that you can get the guild from :attr:`~abc.GuildChannel.guild`. Note that you can get the guild from :attr:`~abc.GuildChannel.guild`.
This requires :attr:`Intents.guilds` to be enabled.
:param channel: The guild channel that got created or deleted. :param channel: The guild channel that got created or deleted.
:type channel: :class:`abc.GuildChannel` :type channel: :class:`abc.GuildChannel`
@ -505,6 +543,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called whenever a guild channel is updated. e.g. changed name, topic, permissions. Called whenever a guild channel is updated. e.g. changed name, topic, permissions.
This requires :attr:`Intents.guilds` to be enabled.
:param before: The updated guild channel's old info. :param before: The updated guild channel's old info.
:type before: :class:`abc.GuildChannel` :type before: :class:`abc.GuildChannel`
:param after: The updated guild channel's new info. :param after: The updated guild channel's new info.
@ -514,6 +554,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called whenever a message is pinned or unpinned from a guild channel. Called whenever a message is pinned or unpinned from a guild channel.
This requires :attr:`Intents.guilds` to be enabled.
:param channel: The guild channel that had its pins updated. :param channel: The guild channel that had its pins updated.
:type channel: :class:`abc.GuildChannel` :type channel: :class:`abc.GuildChannel`
:param last_pin: The latest message that was pinned as a naive datetime in UTC. Could be ``None``. :param last_pin: The latest message that was pinned as a naive datetime in UTC. Could be ``None``.
@ -525,6 +567,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called whenever an integration is created, modified, or removed from a guild. Called whenever an integration is created, modified, or removed from a guild.
This requires :attr:`Intents.integrations` to be enabled.
:param guild: The guild that had its integrations updated. :param guild: The guild that had its integrations updated.
:type guild: :class:`Guild` :type guild: :class:`Guild`
@ -532,6 +576,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called whenever a webhook is created, modified, or removed from a guild channel. Called whenever a webhook is created, modified, or removed from a guild channel.
This requires :attr:`Intents.webhooks` to be enabled.
:param channel: The channel that had its webhooks updated. :param channel: The channel that had its webhooks updated.
:type channel: :class:`abc.GuildChannel` :type channel: :class:`abc.GuildChannel`
@ -540,6 +586,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called when a :class:`Member` leaves or joins a :class:`Guild`. Called when a :class:`Member` leaves or joins a :class:`Guild`.
This requires :attr:`Intents.members` to be enabled.
:param member: The member who joined or left. :param member: The member who joined or left.
:type member: :class:`Member` :type member: :class:`Member`
@ -554,6 +602,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
- nickname - nickname
- roles - roles
This requires :attr:`Intents.members` to be enabled.
:param before: The updated member's old info. :param before: The updated member's old info.
:type before: :class:`Member` :type before: :class:`Member`
:param after: The updated member's updated info. :param after: The updated member's updated info.
@ -569,6 +619,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
- username - username
- discriminator - discriminator
This requires :attr:`Intents.members` to be enabled.
:param before: The updated user's old info. :param before: The updated user's old info.
:type before: :class:`User` :type before: :class:`User`
:param after: The updated user's updated info. :param after: The updated user's updated info.
@ -579,6 +631,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called when a :class:`Guild` is either created by the :class:`Client` or when the Called when a :class:`Guild` is either created by the :class:`Client` or when the
:class:`Client` joins a guild. :class:`Client` joins a guild.
This requires :attr:`Intents.guilds` to be enabled.
:param guild: The guild that was joined. :param guild: The guild that was joined.
:type guild: :class:`Guild` :type guild: :class:`Guild`
@ -596,6 +650,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
In order for this event to be invoked then the :class:`Client` must have In order for this event to be invoked then the :class:`Client` must have
been part of the guild to begin with. (i.e. it is part of :attr:`Client.guilds`) been part of the guild to begin with. (i.e. it is part of :attr:`Client.guilds`)
This requires :attr:`Intents.guilds` to be enabled.
:param guild: The guild that got removed. :param guild: The guild that got removed.
:type guild: :class:`Guild` :type guild: :class:`Guild`
@ -608,6 +664,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
- Changed AFK timeout - Changed AFK timeout
- etc - etc
This requires :attr:`Intents.guilds` to be enabled.
:param before: The guild prior to being updated. :param before: The guild prior to being updated.
:type before: :class:`Guild` :type before: :class:`Guild`
:param after: The guild after being updated. :param after: The guild after being updated.
@ -620,6 +678,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
To get the guild it belongs to, use :attr:`Role.guild`. To get the guild it belongs to, use :attr:`Role.guild`.
This requires :attr:`Intents.guilds` to be enabled.
:param role: The role that was created or deleted. :param role: The role that was created or deleted.
:type role: :class:`Role` :type role: :class:`Role`
@ -627,6 +687,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called when a :class:`Role` is changed guild-wide. Called when a :class:`Role` is changed guild-wide.
This requires :attr:`Intents.guilds` to be enabled.
:param before: The updated role's old info. :param before: The updated role's old info.
:type before: :class:`Role` :type before: :class:`Role`
:param after: The updated role's updated info. :param after: The updated role's updated info.
@ -636,6 +698,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called when a :class:`Guild` adds or removes :class:`Emoji`. Called when a :class:`Guild` adds or removes :class:`Emoji`.
This requires :attr:`Intents.emojis` to be enabled.
:param guild: The guild who got their emojis updated. :param guild: The guild who got their emojis updated.
:type guild: :class:`Guild` :type guild: :class:`Guild`
:param before: A list of emojis before the update. :param before: A list of emojis before the update.
@ -649,6 +713,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called when a guild becomes available or unavailable. The guild must have Called when a guild becomes available or unavailable. The guild must have
existed in the :attr:`Client.guilds` cache. existed in the :attr:`Client.guilds` cache.
This requires :attr:`Intents.emojis` to be enabled.
:param guild: The :class:`Guild` that has changed availability. :param guild: The :class:`Guild` that has changed availability.
.. function:: on_voice_state_update(member, before, after) .. function:: on_voice_state_update(member, before, after)
@ -662,6 +728,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
- A member is muted or deafened by their own accord. - A member is muted or deafened by their own accord.
- A member is muted or deafened by a guild administrator. - A member is muted or deafened by a guild administrator.
This requires :attr:`Intents.voice_states` to be enabled.
:param member: The member whose voice states changed. :param member: The member whose voice states changed.
:type member: :class:`Member` :type member: :class:`Member`
:param before: The voice state prior to the changes. :param before: The voice state prior to the changes.
@ -673,6 +741,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called when user gets banned from a :class:`Guild`. Called when user gets banned from a :class:`Guild`.
This requires :attr:`Intents.bans` to be enabled.
:param guild: The guild the user got banned from. :param guild: The guild the user got banned from.
:type guild: :class:`Guild` :type guild: :class:`Guild`
:param user: The user that got banned. :param user: The user that got banned.
@ -684,6 +754,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Called when a :class:`User` gets unbanned from a :class:`Guild`. Called when a :class:`User` gets unbanned from a :class:`Guild`.
This requires :attr:`Intents.bans` to be enabled.
:param guild: The guild the user got unbanned from. :param guild: The guild the user got unbanned from.
:type guild: :class:`Guild` :type guild: :class:`Guild`
:param user: The user that got unbanned. :param user: The user that got unbanned.
@ -701,6 +773,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
There is a rare possibility that the :attr:`Invite.guild` and :attr:`Invite.channel` There is a rare possibility that the :attr:`Invite.guild` and :attr:`Invite.channel`
attributes will be of :class:`Object` rather than the respective models. attributes will be of :class:`Object` rather than the respective models.
This requires :attr:`Intents.invites` to be enabled.
:param invite: The invite that was created. :param invite: The invite that was created.
:type invite: :class:`Invite` :type invite: :class:`Invite`
@ -719,6 +793,8 @@ to handle it, which defaults to print a traceback and ignoring the exception.
Outside of those two attributes, the only other attribute guaranteed to be Outside of those two attributes, the only other attribute guaranteed to be
filled by the Discord gateway for this event is :attr:`Invite.code`. filled by the Discord gateway for this event is :attr:`Invite.code`.
This requires :attr:`Intents.invites` to be enabled.
:param invite: The invite that was deleted. :param invite: The invite that was deleted.
:type invite: :class:`Invite` :type invite: :class:`Invite`

Loading…
Cancel
Save