From 5cfd45faa446d3f7de2c2a907f5f13477a830a3b Mon Sep 17 00:00:00 2001 From: Sami <samip5@users.noreply.github.com> Date: Fri, 6 Jul 2018 09:19:55 +0300 Subject: [PATCH] Migrate: Was not working before, now it is. --- Music-bot/cogs/misc.py | 2 +- Music-bot/cogs/utils/checks.py | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Music-bot/cogs/misc.py b/Music-bot/cogs/misc.py index 23bbbdf..83c12d9 100644 --- a/Music-bot/cogs/misc.py +++ b/Music-bot/cogs/misc.py @@ -6,7 +6,7 @@ class Misc: def __init__(self, bot): self.bot = bot - @commands.command(name='top_role', aliases=['toprole'], pass_context=True, hidden=False) + @commands.command(name='top_role', aliases=['toprole'], pass_context=True) async def show_toprole(self, ctx, *, member: discord.Member = None): """Simple command which shows the members Top Role.""" diff --git a/Music-bot/cogs/utils/checks.py b/Music-bot/cogs/utils/checks.py index bfb23d6..ab78f4e 100644 --- a/Music-bot/cogs/utils/checks.py +++ b/Music-bot/cogs/utils/checks.py @@ -85,18 +85,17 @@ def admin_or_permissions(**perms): def song_requester_or_dj(): async def predicate(ctx): vc = ctx.voice_client - - if not vc or not vc.is_connected(): - await ctx.send('I am not currently connected to voice!') - - if ctx.message.author.name == vc.source.requester.name: - return True - elif discord.utils.get(ctx.message.author.roles, name="DJ"): - return True - elif ctx.message.author != vc.source.requester or not discord.utils.get(ctx.message.author.roles, name="DJ"): - await ctx.send(f"The bot owner has been naughty and has failed to add a voting system, so sorry but your " - f"permissions are not enough to use this command.") - return False + try: + if ctx.message.author.name == vc.source.requester.name: + return True + elif discord.utils.get(ctx.message.author.roles, name="DJ"): + return True + elif ctx.message.author != vc.source.requester or not discord.utils.get(ctx.message.author.roles, name="DJ"): + await ctx.send(f"The bot owner has been naughty and has failed to add a voting system, so sorry but your " + f"permissions are not enough to use this command.") + return False + except AttributeError: + pass return commands.check(predicate) -- GitLab