diff options
| author | Nadir Chowdhury <[email protected]> | 2021-04-11 20:13:23 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-04-11 15:13:23 -0400 |
| commit | f1fac96e33e20d70859ebcf6bac439d406c04727 (patch) | |
| tree | 6cf310d89eee76423617a1b0606e84a6b0b8ea9e /discord | |
| parent | [commands] Add support for Python 3.10 Union typing (diff) | |
| download | discord.py-f1fac96e33e20d70859ebcf6bac439d406c04727.tar.xz discord.py-f1fac96e33e20d70859ebcf6bac439d406c04727.zip | |
Remove `private_channel_(delete/create)` events
Diffstat (limited to 'discord')
| -rw-r--r-- | discord/flags.py | 2 | ||||
| -rw-r--r-- | discord/state.py | 30 |
2 files changed, 8 insertions, 24 deletions
diff --git a/discord/flags.py b/discord/flags.py index edbfd3d8..7585222a 100644 --- a/discord/flags.py +++ b/discord/flags.py @@ -627,7 +627,6 @@ class Intents(BaseFlags): - :func:`on_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_private_channel_create` 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_raw_message_delete` (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: diff --git a/discord/state.py b/discord/state.py index fc6974d1..777bed58 100644 --- a/discord/state.py +++ b/discord/state.py @@ -631,13 +631,6 @@ class ConnectionState: if channel is not None: guild._remove_channel(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): 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']) return - if ch_type in (ChannelType.group, ChannelType.private): - channel_id = int(data['id']) - if self._get_private_channel(channel_id) is None: - channel = factory(me=self.user, data=data, state=self) - self._add_private_channel(channel) - self.dispatch('private_channel_create', channel) + guild_id = utils._get_as_snowflake(data, 'guild_id') + guild = self._get_guild(guild_id) + if guild is not None: + channel = factory(guild=guild, state=self, data=data) + guild._add_channel(channel) + self.dispatch('guild_channel_create', channel) else: - guild_id = utils._get_as_snowflake(data, 'guild_id') - guild = self._get_guild(guild_id) - 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 + log.debug('CHANNEL_CREATE referencing an unknown guild ID: %s. Discarding.', guild_id) + return def parse_channel_pins_update(self, data): channel_id = int(data['channel_id']) |