Merge pull request #40 from r-Norge/dev

This commit is contained in:
Roxedus authored and GitHub committed 2021-05-18 19:35:56 +02:00
commit 274946ef44
5 files changed
+42 -18

No files matched your search

+15 -14
View File
@@ -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:
+2 -2
View File
@@ -120,8 +120,8 @@ class Music(commands.Cog):
# commands
from .basic_commands import (
_disconnect, _djremove, _forceplay, _move, _myqueue, _now, _pause, _play, _queue, _reconnect, _remove, _search,
_seek, _shuffle, _skip, _skip_to, _stop, _user_queue_remove, _volume)
_disconnect, _djremove, _forcedisconnect, _forceplay, _move, _myqueue, _now, _pause, _play, _queue, _reconnect,
_remove, _search, _seek, _shuffle, _skip, _skip_to, _stop, _user_queue_remove, _volume)
# events
from .events import check_leave_voice, cog_unload, leave_check, leave_timer, on_voice_state_update, track_hook
# commands
+16
View File
@@ -439,3 +439,19 @@ async def _forceplay(self, ctx, *, query: str):
if not player.is_playing:
await player.play()
@commands.command(name='forcedisconnect')
@checks.dj_or(alone=True)
async def _forcedisconnect(self, ctx):
""" Attempts to force disconnect the bot without checking if it is connected initially. """
try:
player = self.bot.lavalink.player_manager.get(ctx.guild.id)
player.queue.clear()
await player.stop()
except Exception:
self.logger.exception("Error forcedisconnecting")
await self.connect_to(ctx.guild.id, None)
embed = discord.Embed(description='{disconnect.disconnected}', color=ctx.me.color)
embed = ctx.localizer.format_embed(embed)
await ctx.send(embed=embed)
+3 -1
View File
@@ -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)
+6 -1
View File
@@ -3,7 +3,9 @@ import discord
from discord.ext import commands
# Bot Utilities
from cogs.helpformatter import commandhelper
from cogs.utils import checks
from cogs.utils.paginator import Scroller
class Settings(commands.Cog):
@@ -22,7 +24,10 @@ class Settings(commands.Cog):
@commands.group(name='settings', hidden=True)
async def _set(self, ctx):
if ctx.invoked_subcommand is None:
await self.current_settings.invoke(ctx)
ctx.localizer.prefix = 'help' # Ensure the bot looks for locales in the context of help, not cogmanager.
paginator = commandhelper(ctx, ctx.command, ctx.invoker, include_subcmd=True)
scroller = Scroller(ctx, paginator)
await scroller.start_scrolling()
@checks.is_admin()
@commands.guild_only()