Remove private_channel_(delete/create)
events
This commit is contained in:
parent
74d8ad2013
commit
f1fac96e33
@ -627,7 +627,6 @@ class Intents(BaseFlags):
|
|||||||
- :func:`on_message_delete` (both guilds and DMs)
|
- :func:`on_message_delete` (both guilds and DMs)
|
||||||
- :func:`on_raw_message_delete` (both guilds and DMs)
|
- :func:`on_raw_message_delete` (both guilds and DMs)
|
||||||
- :func:`on_raw_message_edit` (both guilds and DMs)
|
- :func:`on_raw_message_edit` (both guilds and DMs)
|
||||||
- :func:`on_private_channel_create`
|
|
||||||
|
|
||||||
This also corresponds to the following attributes and classes in terms of cache:
|
This also corresponds to the following attributes and classes in terms of cache:
|
||||||
|
|
||||||
@ -682,7 +681,6 @@ class Intents(BaseFlags):
|
|||||||
- :func:`on_message_delete` (only for DMs)
|
- :func:`on_message_delete` (only for DMs)
|
||||||
- :func:`on_raw_message_delete` (only for DMs)
|
- :func:`on_raw_message_delete` (only for DMs)
|
||||||
- :func:`on_raw_message_edit` (only for DMs)
|
- :func:`on_raw_message_edit` (only for DMs)
|
||||||
- :func:`on_private_channel_create`
|
|
||||||
|
|
||||||
This also corresponds to the following attributes and classes in terms of cache:
|
This also corresponds to the following attributes and classes in terms of cache:
|
||||||
|
|
||||||
|
@ -631,13 +631,6 @@ class ConnectionState:
|
|||||||
if channel is not None:
|
if channel is not None:
|
||||||
guild._remove_channel(channel)
|
guild._remove_channel(channel)
|
||||||
self.dispatch('guild_channel_delete', channel)
|
self.dispatch('guild_channel_delete', channel)
|
||||||
else:
|
|
||||||
# the reason we're doing this is so it's also removed from the
|
|
||||||
# private channel by user cache as well
|
|
||||||
channel = self._get_private_channel(channel_id)
|
|
||||||
if channel is not None:
|
|
||||||
self._remove_private_channel(channel)
|
|
||||||
self.dispatch('private_channel_delete', channel)
|
|
||||||
|
|
||||||
def parse_channel_update(self, data):
|
def parse_channel_update(self, data):
|
||||||
channel_type = try_enum(ChannelType, data.get('type'))
|
channel_type = try_enum(ChannelType, data.get('type'))
|
||||||
@ -668,22 +661,15 @@ class ConnectionState:
|
|||||||
log.debug('CHANNEL_CREATE referencing an unknown channel type %s. Discarding.', data['type'])
|
log.debug('CHANNEL_CREATE referencing an unknown channel type %s. Discarding.', data['type'])
|
||||||
return
|
return
|
||||||
|
|
||||||
if ch_type in (ChannelType.group, ChannelType.private):
|
guild_id = utils._get_as_snowflake(data, 'guild_id')
|
||||||
channel_id = int(data['id'])
|
guild = self._get_guild(guild_id)
|
||||||
if self._get_private_channel(channel_id) is None:
|
if guild is not None:
|
||||||
channel = factory(me=self.user, data=data, state=self)
|
channel = factory(guild=guild, state=self, data=data)
|
||||||
self._add_private_channel(channel)
|
guild._add_channel(channel)
|
||||||
self.dispatch('private_channel_create', channel)
|
self.dispatch('guild_channel_create', channel)
|
||||||
else:
|
else:
|
||||||
guild_id = utils._get_as_snowflake(data, 'guild_id')
|
log.debug('CHANNEL_CREATE referencing an unknown guild ID: %s. Discarding.', guild_id)
|
||||||
guild = self._get_guild(guild_id)
|
return
|
||||||
if guild is not None:
|
|
||||||
channel = factory(guild=guild, state=self, data=data)
|
|
||||||
guild._add_channel(channel)
|
|
||||||
self.dispatch('guild_channel_create', channel)
|
|
||||||
else:
|
|
||||||
log.debug('CHANNEL_CREATE referencing an unknown guild ID: %s. Discarding.', guild_id)
|
|
||||||
return
|
|
||||||
|
|
||||||
def parse_channel_pins_update(self, data):
|
def parse_channel_pins_update(self, data):
|
||||||
channel_id = int(data['channel_id'])
|
channel_id = int(data['channel_id'])
|
||||||
|
10
docs/api.rst
10
docs/api.rst
@ -596,16 +596,6 @@ to handle it, which defaults to print a traceback and ignoring the exception.
|
|||||||
:param interaction: The interaction data.
|
:param interaction: The interaction data.
|
||||||
:type interaction: :class:`Interaction`
|
:type interaction: :class:`Interaction`
|
||||||
|
|
||||||
.. function:: on_private_channel_delete(channel)
|
|
||||||
on_private_channel_create(channel)
|
|
||||||
|
|
||||||
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.
|
|
||||||
:type channel: :class:`abc.PrivateChannel`
|
|
||||||
|
|
||||||
.. function:: on_private_channel_update(before, after)
|
.. function:: on_private_channel_update(before, after)
|
||||||
|
|
||||||
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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user