Skip to content

Commit

Permalink
Improve channel fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenChen committed Nov 6, 2024
1 parent 6a8cd24 commit 14f6041
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kurisu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 14f6041

Please sign in to comment.