fix (topgg): Specific command warding.

This commit is contained in:
2022-01-22 07:07:56 +02:00
parent 28bed5899a
commit 8723bba42a
2 changed files with 7 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
import discord import discord
from .module import module 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 settings.user_settings import UserSettings
from LionContext import LionContext from LionContext import LionContext
@@ -41,7 +41,6 @@ async def cmd_forcevote(ctx: LionContext):
group="Economy", group="Economy",
aliases=('topgg', 'topggvote', 'upvote') aliases=('topgg', 'topggvote', 'upvote')
) )
@in_guild()
async def cmd_vote(ctx: LionContext): async def cmd_vote(ctx: LionContext):
""" """
Usage``: Usage``:

View File

@@ -32,17 +32,15 @@ async def unregister_hook(client):
client.log("Unloaded top.gg hooks.", context="TOPGG") client.log("Unloaded top.gg hooks.", context="TOPGG")
async def topgg_reply_wrapper(func, *args, suggest_vote=True, **kwargs): async def topgg_reply_wrapper(func, ctx: LionContext, *args, suggest_vote=True, **kwargs):
ctx = args[0]
if not suggest_vote: if not suggest_vote:
pass pass
elif ctx.cmd and ctx.cmd.name == 'config': elif ctx.cmd and ctx.cmd.name == 'config':
pass pass
elif ctx.cmd and ctx.cmd.name == 'help' and ctx.args and ctx.args.split(maxsplit=1)[0].lower() == 'vote': elif ctx.cmd and ctx.cmd.name == 'help' and ctx.args and ctx.args.split(maxsplit=1)[0].lower() == 'vote':
pass pass
elif not get_last_voted_timestamp(args[0].author.id): elif not get_last_voted_timestamp(ctx.author.id):
upvote_info_formatted = upvote_info.format(lion_yayemote, args[0].best_prefix, lion_loveemote) upvote_info_formatted = upvote_info.format(lion_yayemote, ctx.best_prefix, lion_loveemote)
if 'embed' in kwargs: if 'embed' in kwargs:
# Add message as an extra embed field # 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 # Add message to content
if 'content' in kwargs and kwargs['content'] and len(kwargs['content']) + len(upvote_info_formatted) < 1998: if 'content' in kwargs and kwargs['content'] and len(kwargs['content']) + len(upvote_info_formatted) < 1998:
kwargs['content'] += '\n\n' + upvote_info_formatted 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 = list(args)
args[1] += '\n\n' + upvote_info_formatted args[0] += '\n\n' + upvote_info_formatted
else: else:
kwargs['content'] = upvote_info_formatted kwargs['content'] = upvote_info_formatted
return await func(*args, **kwargs) return await func(ctx, *args, **kwargs)
def economy_bonus(lion): def economy_bonus(lion):