oh ffs
This commit is contained in:
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -20,6 +20,9 @@ labels: bug
|
|||||||
|
|
||||||
<!-- What actually happened. If there is a traceback, please show the entire thing. -->
|
<!-- What actually happened. If there is a traceback, please show the entire thing. -->
|
||||||
|
|
||||||
|
## Intents
|
||||||
|
|
||||||
|
<!-- What intents are you using for your bot? This is the `discord.Intents` class you pass to the client -->
|
||||||
|
|
||||||
## Checklist
|
## Checklist
|
||||||
|
|
||||||
@@ -28,6 +31,7 @@ labels: bug
|
|||||||
- [ ] I have searched the open issues for duplicates.
|
- [ ] I have searched the open issues for duplicates.
|
||||||
- [ ] I have shown the entire traceback, if possible.
|
- [ ] I have shown the entire traceback, if possible.
|
||||||
- [ ] I have removed my token from display, if visible.
|
- [ ] I have removed my token from display, if visible.
|
||||||
|
- [ ] I have provided the intents that my bot is using.
|
||||||
|
|
||||||
## System Information
|
## System Information
|
||||||
|
|
||||||
|
|||||||
@@ -206,6 +206,9 @@ class GuildChannel:
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _sorting_bucket(self):
|
def _sorting_bucket(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ class Client:
|
|||||||
self._listeners = {}
|
self._listeners = {}
|
||||||
self.shard_id = options.get('shard_id')
|
self.shard_id = options.get('shard_id')
|
||||||
self.shard_count = options.get('shard_count')
|
self.shard_count = options.get('shard_count')
|
||||||
colour = options.get('embed_color')
|
colour = options.get('embed_color', Color.default())
|
||||||
if isinstance(colour, (Color, Colour)):
|
if isinstance(colour, (Color, Colour)):
|
||||||
os.environ['DEFAULT_EMBED_COLOR'] = str(hex(colour))
|
os.environ['DEFAULT_EMBED_COLOR'] = str(hex(colour))
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -112,6 +112,9 @@ class Emoji(_EmojiTag):
|
|||||||
return '<a:{0.name}:{0.id}>'.format(self)
|
return '<a:{0.name}:{0.id}>'.format(self)
|
||||||
return "<:{0.name}:{0.id}>".format(self)
|
return "<:{0.name}:{0.id}>".format(self)
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Emoji id={0.id} name={0.name!r} animated={0.animated} managed={0.managed}>'.format(self)
|
return '<Emoji id={0.id} name={0.name!r} animated={0.animated} managed={0.managed}>'.format(self)
|
||||||
|
|
||||||
|
|||||||
@@ -207,6 +207,9 @@ class Guild(Hashable):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
attrs = (
|
attrs = (
|
||||||
'id', 'name', 'shard_id', 'chunked'
|
'id', 'name', 'shard_id', 'chunked'
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ class Attachment:
|
|||||||
""":class:`bool`: Whether this attachment contains a spoiler."""
|
""":class:`bool`: Whether this attachment contains a spoiler."""
|
||||||
return self.filename.startswith('SPOILER_')
|
return self.filename.startswith('SPOILER_')
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Attachment id={0.id} filename={0.filename!r} url={0.url!r}>'.format(self)
|
return '<Attachment id={0.id} filename={0.filename!r} url={0.url!r}>'.format(self)
|
||||||
|
|
||||||
@@ -385,6 +388,12 @@ class Message:
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.content
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Message id={0.id} channel={0.channel!r} type={0.type!r} author={0.author!r} flags={0.flags!r}>'.format(self)
|
return '<Message id={0.id} channel={0.channel!r} type={0.type!r} author={0.author!r} flags={0.flags!r}>'.format(self)
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,9 @@ class Role(Hashable):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<Role id={0.id} name={0.name!r}>'.format(self)
|
return '<Role id={0.id} name={0.name!r}>'.format(self)
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ class BaseUser(_BaseUser):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{0.name}#{0.discriminator}'.format(self)
|
return '{0.name}#{0.discriminator}'.format(self)
|
||||||
|
|
||||||
|
def __int__(self):
|
||||||
|
return self.id
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return isinstance(other, _BaseUser) and other.id == self.id
|
return isinstance(other, _BaseUser) and other.id == self.id
|
||||||
|
|
||||||
|
|||||||
@@ -533,6 +533,12 @@ def escape_mentions(text):
|
|||||||
|
|
||||||
This does not include channel mentions.
|
This does not include channel mentions.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
For more granular control over what mentions should be escaped
|
||||||
|
within messages, refer to the :class:`~discord.AllowedMentions`
|
||||||
|
class.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
-----------
|
-----------
|
||||||
text: :class:`str`
|
text: :class:`str`
|
||||||
|
|||||||
76
docs/api.rst
76
docs/api.rst
@@ -322,6 +322,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.
|
||||||
@@ -333,6 +335,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
|
||||||
@@ -354,6 +358,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`
|
||||||
|
|
||||||
@@ -369,6 +375,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`]
|
||||||
|
|
||||||
@@ -380,6 +388,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`
|
||||||
|
|
||||||
@@ -391,6 +401,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`
|
||||||
|
|
||||||
@@ -415,6 +427,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.
|
||||||
@@ -436,6 +450,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`
|
||||||
|
|
||||||
@@ -449,6 +465,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.
|
||||||
@@ -459,6 +477,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`
|
||||||
|
|
||||||
@@ -472,6 +492,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.
|
||||||
@@ -482,6 +504,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`
|
||||||
|
|
||||||
@@ -491,6 +515,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.
|
||||||
@@ -501,6 +527,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`
|
||||||
|
|
||||||
@@ -510,6 +538,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.
|
||||||
@@ -520,6 +550,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.
|
||||||
@@ -530,6 +562,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`
|
||||||
|
|
||||||
@@ -537,6 +571,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.
|
||||||
@@ -558,6 +594,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`
|
||||||
|
|
||||||
@@ -565,6 +603,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.
|
||||||
@@ -574,6 +614,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``.
|
||||||
@@ -585,6 +627,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`
|
||||||
|
|
||||||
@@ -592,6 +636,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`
|
||||||
|
|
||||||
@@ -600,6 +646,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`
|
||||||
|
|
||||||
@@ -614,6 +662,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.
|
||||||
@@ -629,6 +679,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.
|
||||||
@@ -639,6 +691,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`
|
||||||
|
|
||||||
@@ -656,6 +710,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`
|
||||||
|
|
||||||
@@ -668,6 +724,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.
|
||||||
@@ -680,6 +738,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`
|
||||||
|
|
||||||
@@ -687,6 +747,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.
|
||||||
@@ -696,6 +758,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.
|
||||||
@@ -709,6 +773,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)
|
||||||
@@ -722,6 +788,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.
|
||||||
@@ -733,6 +801,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.
|
||||||
@@ -744,6 +814,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.
|
||||||
@@ -761,6 +833,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`
|
||||||
|
|
||||||
@@ -779,6 +853,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`
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,13 @@ Custom Features
|
|||||||
- ``Guild.icon_url`` and ``User.avatar_url`` return the string in stead of Asset. use icon/avatar url_as to get the Asset
|
- ``Guild.icon_url`` and ``User.avatar_url`` return the string in stead of Asset. use icon/avatar url_as to get the Asset
|
||||||
- Merged in ext-colors (https://github.com/MGardne8/DiscordPyColours)
|
- Merged in ext-colors (https://github.com/MGardne8/DiscordPyColours)
|
||||||
- Using Rapptz/discord.py/tree/neo-docs for documentation
|
- Using Rapptz/discord.py/tree/neo-docs for documentation
|
||||||
- Adding support for ``hex()`` to ``discord.Color``
|
- Added support for ``hex()`` to ``discord.Color``
|
||||||
- Added ``Client.embed_color`` / ``Bot.embed_color``
|
- Added ``Client.embed_color`` / ``Bot.embed_color``
|
||||||
- Added ``Client.set_embed_color`` / ``Bot.set_embed_color``
|
- Added ``Client.set_embed_color`` / ``Bot.set_embed_color``
|
||||||
- Added ``TextChannel.can_send``
|
- Added ``TextChannel.can_send``
|
||||||
- Added ``Intents.from_list``
|
- Added ``Intents.from_list``
|
||||||
|
- Added support for ``int()`` to ``discord.User``, ``discord.Member``, ``discord.Role``, ``discord.Guild``, ``discord.Message``, ``discord.TextChannel``, ``discord.VoiceChannel``, ``discord.CategoryChannel``, ``discord.Attachment`` and ``discord.Message``. This will return their id
|
||||||
|
- Added support for ``str()`` to ``discord.Message``. This will return the message content
|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ For example:
|
|||||||
.. code-block:: python3
|
.. code-block:: python3
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
intents = discord.Intents()
|
intents = discord.Intents.default()
|
||||||
intents.members = True
|
intents.members = True
|
||||||
|
|
||||||
# Somewhere else:
|
# Somewhere else:
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# This example requires the 'members' privileged intents
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
import random
|
import random
|
||||||
@@ -6,7 +8,11 @@ description = '''An example bot to showcase the discord.ext.commands extension
|
|||||||
module.
|
module.
|
||||||
|
|
||||||
There are a number of utility commands being showcased here.'''
|
There are a number of utility commands being showcased here.'''
|
||||||
bot = commands.Bot(command_prefix='?', description=description)
|
|
||||||
|
intents = discord.Intents.default()
|
||||||
|
intents.members = True
|
||||||
|
|
||||||
|
bot = commands.Bot(command_prefix='?', description=description, intents=intents)
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# This example requires the 'members' privileged intents
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
class MyClient(discord.Client):
|
class MyClient(discord.Client):
|
||||||
@@ -14,5 +16,8 @@ class MyClient(discord.Client):
|
|||||||
await guild.system_channel.send(to_send)
|
await guild.system_channel.send(to_send)
|
||||||
|
|
||||||
|
|
||||||
client = MyClient()
|
intents = discord.Intents.default()
|
||||||
|
intents.members = True
|
||||||
|
|
||||||
|
client = MyClient(intents=intents)
|
||||||
client.run('token')
|
client.run('token')
|
||||||
|
|||||||
Reference in New Issue
Block a user