From 7c71feac2333b7076bf13e1d6d8752787970e26b Mon Sep 17 00:00:00 2001 From: Rapptz Date: Mon, 4 Jul 2022 05:43:46 -0400 Subject: [PATCH] Change abc.PrivateChannel to be a proper subclass This fixes isinstance(thread, discord.abc.PrivateChannel) from returning True --- discord/abc.py | 4 ++-- discord/channel.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/discord/abc.py b/discord/abc.py index 9d3d38b8c..557e2e2c8 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -369,8 +369,7 @@ class User(Snowflake, Protocol): raise NotImplementedError -@runtime_checkable -class PrivateChannel(Snowflake, Protocol): +class PrivateChannel: """An ABC that details the common operations on a private Discord channel. The following implement this ABC: @@ -388,6 +387,7 @@ class PrivateChannel(Snowflake, Protocol): __slots__ = () + id: int me: ClientUser def _add_call(self, **kwargs): diff --git a/discord/channel.py b/discord/channel.py index 065d927b0..2a021496b 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -2301,7 +2301,7 @@ class ForumChannel(discord.abc.GuildChannel, Hashable): return Webhook.from_state(data, state=self._state) -class DMChannel(discord.abc.Messageable, discord.abc.Connectable, Hashable): +class DMChannel(discord.abc.Messageable, discord.abc.Connectable, discord.abc.PrivateChannel, Hashable): """Represents a Discord direct message channel. .. container:: operations @@ -2640,7 +2640,7 @@ class DMChannel(discord.abc.Messageable, discord.abc.Connectable, Hashable): await self._state.http.decline_message_request(self.id) -class GroupChannel(discord.abc.Messageable, discord.abc.Connectable, Hashable): +class GroupChannel(discord.abc.Messageable, discord.abc.Connectable, discord.abc.PrivateChannel, Hashable): """Represents a Discord group channel. .. container:: operations