Discord utils: fixed to_string function to work correctly with channels objects
This commit is contained in:
parent
4a656685c0
commit
f474205462
|
|
@ -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})"
|
||||
|
|
|
|||
Loading…
Reference in New Issue