1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Spaghetti around a !summon bug

This commit is contained in:
Steffo 2019-10-25 13:26:50 +02:00
parent cad0bb3538
commit beb670eb89

View file

@ -18,9 +18,11 @@ class SummonCommand(Command):
"""Handle a summon Royalnet request. """Handle a summon Royalnet request.
That is, join a voice channel, or move to a different one if that is not possible.""" That is, join a voice channel, or move to a different one if that is not possible."""
channels = bot.client.find_channel_by_name(channel_name) channels = bot.client.find_channel_by_name(channel_name)
if len(channels) < 1:
raise CommandError(f"Nessun canale vocale con il nome [c]{channel_name}[/c] trovato.")
channel = channels[0] channel = channels[0]
if not isinstance(channel, discord.VoiceChannel): if not isinstance(channel, discord.VoiceChannel):
raise CommandError("Channel is not a voice channel") raise CommandError(f"Il canale [c]{channel}[/c] non è un canale vocale.")
bot.loop.create_task(bot.client.vc_connect_or_move(channel)) bot.loop.create_task(bot.client.vc_connect_or_move(channel))
return {} return {}