From 5de9287902ae3d4c1a9fc16ed6e7b3dcf204d6a0 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 ea6c59ab8..d0d35dc76 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -272,8 +272,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: @@ -291,6 +290,7 @@ class PrivateChannel(Snowflake, Protocol): __slots__ = () + id: int me: ClientUser diff --git a/discord/channel.py b/discord/channel.py index 2e441dd6e..89a119ede 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -2381,7 +2381,7 @@ class ForumChannel(discord.abc.GuildChannel, Hashable): return Webhook.from_state(data, state=self._state) -class DMChannel(discord.abc.Messageable, Hashable): +class DMChannel(discord.abc.Messageable, discord.abc.PrivateChannel, Hashable): """Represents a Discord direct message channel. .. container:: operations @@ -2533,7 +2533,7 @@ class DMChannel(discord.abc.Messageable, Hashable): return PartialMessage(channel=self, id=message_id) -class GroupChannel(discord.abc.Messageable, Hashable): +class GroupChannel(discord.abc.Messageable, discord.abc.PrivateChannel, Hashable): """Represents a Discord group channel. .. container:: operations