From f4742054625015c669c8be0fd774555ebf4ac312 Mon Sep 17 00:00:00 2001 From: Elnath Date: Tue, 20 Apr 2021 17:55:17 +0200 Subject: [PATCH] Discord utils: fixed to_string function to work correctly with channels objects --- utils/discord_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/discord_utils.py b/utils/discord_utils.py index 7146231..0fab5f5 100644 --- a/utils/discord_utils.py +++ b/utils/discord_utils.py @@ -59,6 +59,9 @@ def _(guild) -> str: return f"{guild.name}({guild.id})" -@to_string.register(discord.abc.GuildChannel) +# Even though these types are all subclasses of discord.abc.GuildChannel, it does not work if we register that class directly +@to_string.register(discord.TextChannel) +@to_string.register(discord.VoiceChannel) +@to_string.register(discord.CategoryChannel) def _(channel) -> str: return f"{channel.name}({channel.id})"