From 14f6041bb983bc1b0e442108f86bcc443cace4bb Mon Sep 17 00:00:00 2001 From: FrozenChen Date: Wed, 6 Nov 2024 01:34:03 -0300 Subject: [PATCH] Improve channel fallback --- kurisu.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kurisu.py b/kurisu.py index 7c6d21ef..ad29d4fc 100644 --- a/kurisu.py +++ b/kurisu.py @@ -289,8 +289,9 @@ async def load_channels(self): if channel and isinstance(channel, (discord.TextChannel, discord.VoiceChannel)): self.channels[n] = channel continue - channel = discord.utils.get(self.guild.channels, name=n) - if channel and isinstance(channel, (discord.TextChannel, discord.VoiceChannel)): + channel = discord.utils.find(lambda c: c.name == n and isinstance(c, (discord.TextChannel, discord.VoiceChannel)), self.guild.channels) + if channel: + assert isinstance(channel, (discord.TextChannel, discord.VoiceChannel)) self.channels[n] = channel await self.configuration.add_channel(name=n, channel=channel) else: