mirror of
https://github.com/UiO-Gaming/ShiteMusicBot.git
synced 2026-11-05 13:56:51 +01:00
Make the bot say which voice channel it is currently being used in.
This commit is contained in:
1 parent
05753b8785
commit
dd08ae4bc3
2 files changed
+18
-15
No files matched your search
+15
-14
@@ -55,9 +55,6 @@ class Errors(commands.Cog):
|
||||
elif (err.original == 'I need the `CONNECT` and `SPEAK` permissions.'):
|
||||
return await send_error_embed('{errors.need_permission}')
|
||||
|
||||
elif (err.original == 'You need to be in my voicechannel.'):
|
||||
return await send_error_embed('{errors.my_channel}')
|
||||
|
||||
elif (err.original == 'Not playing'):
|
||||
return await send_error_embed('{not_playing}')
|
||||
|
||||
@@ -68,17 +65,21 @@ class Errors(commands.Cog):
|
||||
return await send_error_embed('{errors.full_channel}')
|
||||
|
||||
if isinstance(err, WrongVoiceChannelError):
|
||||
changed = False
|
||||
response = ctx.localizer.format_str('{settings_check.voicechannel}')
|
||||
for channel_id in err.channels:
|
||||
channel = ctx.guild.get_channel(channel_id)
|
||||
if channel is not None:
|
||||
response += f'{channel.name}, '
|
||||
changed = True
|
||||
if changed:
|
||||
return await send_error_embed(response[:-2], title='{errors.right_channel}')
|
||||
else:
|
||||
return await send_error_embed('{errors.right_channel}')
|
||||
if(err.original.startswith("You need to be in my voice channel")):
|
||||
return await send_error_embed(err.channels[0].name, title='{errors.my_channel}')
|
||||
|
||||
elif (err.original.startswith('You need to be in the right voice channel')):
|
||||
changed = False
|
||||
response = ctx.localizer.format_str('{settings_check.voicechannel}')
|
||||
for channel_id in err.channels:
|
||||
channel = ctx.guild.get_channel(channel_id)
|
||||
if channel is not None:
|
||||
response += f'{channel.name}, '
|
||||
changed = True
|
||||
if changed:
|
||||
return await send_error_embed(response[:-2], title='{errors.right_channel}')
|
||||
else:
|
||||
return await send_error_embed('{errors.right_channel}')
|
||||
|
||||
if isinstance(err, WrongTextChannelError):
|
||||
try:
|
||||
|
||||
@@ -49,7 +49,9 @@ def require_voice_connection(should_connect=False):
|
||||
await self.connect_to(ctx.guild.id, str(ctx.author.voice.channel.id))
|
||||
|
||||
elif int(player.channel_id) != ctx.author.voice.channel.id:
|
||||
raise commands.CommandInvokeError('You need to be in my voicechannel.')
|
||||
bot_channel = self.bot.get_channel(int(player.channel_id))
|
||||
raise WrongVoiceChannelError(
|
||||
'You need to be in my voice channel', channels=[bot_channel])
|
||||
|
||||
await func(self, ctx, *command_args, **kwargs)
|
||||
|
||||
|
||||
Reference in new issue
Block a user