From 8723bba42a6d20fae50037c7df1e3dc01eb2cff7 Mon Sep 17 00:00:00 2001 From: Conatum Date: Sat, 22 Jan 2022 07:07:56 +0200 Subject: [PATCH] fix (topgg): Specific command warding. --- bot/modules/topgg/commands.py | 3 +-- bot/modules/topgg/module.py | 14 ++++++-------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/bot/modules/topgg/commands.py b/bot/modules/topgg/commands.py index b9ff116c..e70c05ca 100644 --- a/bot/modules/topgg/commands.py +++ b/bot/modules/topgg/commands.py @@ -1,6 +1,6 @@ import discord from .module import module -from bot.cmdClient.checks import in_guild, is_owner +from cmdClient.checks import is_owner from settings.user_settings import UserSettings from LionContext import LionContext @@ -41,7 +41,6 @@ async def cmd_forcevote(ctx: LionContext): group="Economy", aliases=('topgg', 'topggvote', 'upvote') ) -@in_guild() async def cmd_vote(ctx: LionContext): """ Usage``: diff --git a/bot/modules/topgg/module.py b/bot/modules/topgg/module.py index a6e6857e..0ea5e532 100644 --- a/bot/modules/topgg/module.py +++ b/bot/modules/topgg/module.py @@ -32,17 +32,15 @@ async def unregister_hook(client): client.log("Unloaded top.gg hooks.", context="TOPGG") -async def topgg_reply_wrapper(func, *args, suggest_vote=True, **kwargs): - ctx = args[0] - +async def topgg_reply_wrapper(func, ctx: LionContext, *args, suggest_vote=True, **kwargs): if not suggest_vote: pass elif ctx.cmd and ctx.cmd.name == 'config': pass elif ctx.cmd and ctx.cmd.name == 'help' and ctx.args and ctx.args.split(maxsplit=1)[0].lower() == 'vote': pass - elif not get_last_voted_timestamp(args[0].author.id): - upvote_info_formatted = upvote_info.format(lion_yayemote, args[0].best_prefix, lion_loveemote) + elif not get_last_voted_timestamp(ctx.author.id): + upvote_info_formatted = upvote_info.format(lion_yayemote, ctx.best_prefix, lion_loveemote) if 'embed' in kwargs: # Add message as an extra embed field @@ -57,13 +55,13 @@ async def topgg_reply_wrapper(func, *args, suggest_vote=True, **kwargs): # Add message to content if 'content' in kwargs and kwargs['content'] and len(kwargs['content']) + len(upvote_info_formatted) < 1998: kwargs['content'] += '\n\n' + upvote_info_formatted - elif len(args) > 1 and len(args[1]) + len(upvote_info_formatted) < 1998: + elif args and len(args[0]) + len(upvote_info_formatted) < 1998: args = list(args) - args[1] += '\n\n' + upvote_info_formatted + args[0] += '\n\n' + upvote_info_formatted else: kwargs['content'] = upvote_info_formatted - return await func(*args, **kwargs) + return await func(ctx, *args, **kwargs) def economy_bonus(lion):