From 417e31c7ab9ecb17599e114bd3c8dfe32ec48294 Mon Sep 17 00:00:00 2001 From: Harsha Raghu Date: Tue, 18 Jan 2022 21:14:05 +0530 Subject: [PATCH] Finalize Topgg bot messages --- bot/modules/topgg/commands.py | 7 ++++--- bot/modules/topgg/module.py | 13 +++++++++---- bot/modules/topgg/utils.py | 19 +++++++++++++------ 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/bot/modules/topgg/commands.py b/bot/modules/topgg/commands.py index f473fbe0..58e41eed 100644 --- a/bot/modules/topgg/commands.py +++ b/bot/modules/topgg/commands.py @@ -5,6 +5,7 @@ from bot.cmdClient.checks.global_perms import in_guild from settings.user_settings import UserSettings from .webhook import on_dbl_vote +from .utils import * @module.cmd( "forcevote", @@ -50,11 +51,11 @@ async def cmd_vote(ctx): target = ctx.author embed=discord.Embed( - title="Topgg Upvote", - description='Please click [here](https://top.gg/bot/889078613817831495/vote) to upvote.\n\nThanks.', + title="Claim your boost!", + description='Please click [here](https://top.gg/bot/889078613817831495/vote) vote and support our bot!\n\nThank you! {}.'.format(lion_loveemote), colour=discord.Colour.orange() ).set_thumbnail( - url="https://cdn.discordapp.com/attachments/908283085999706153/930851470994182144/lionlogo.png" + url="https://cdn.discordapp.com/attachments/908283085999706153/933012309532614666/lion-love.png" ) return await ctx.reply(embed=embed) diff --git a/bot/modules/topgg/module.py b/bot/modules/topgg/module.py index 83a4069d..94cef145 100644 --- a/bot/modules/topgg/module.py +++ b/bot/modules/topgg/module.py @@ -8,6 +8,8 @@ from .webhook import init_webhook module = LionModule("Topgg") +upvote_info = "You have a boost available {}, to support our project and earn **25% more LionCoins** type `{}vote` {}" + @module.launch_task async def register_hook(client): init_webhook() @@ -28,20 +30,23 @@ def reply(util_func, *args, **kwargs): if not get_last_voted_timestamp(args[0].author.id): args = list(args) + + upvote_info_formatted = upvote_info.format(lion_yayemote, args[0].best_prefix, lion_loveemote) + if 'embed' in kwargs: kwargs['embed'].add_field( name="\u200b", value=( - f"Upvote me to get 🌟**+25% Economy Boost**🌟 - Use `!vote`" + upvote_info_formatted ), inline=False ) elif 'content' in args and args['content']: - args['content'] += "\n\nUpvote me to get 🌟**+25% Economy Boost**🌟 - Use `!vote`" + args['content'] += '\n\n' + upvote_info_formatted elif len(args) > 1: - args[1] += "\n\nUpvote me to get 🌟**+25% Economy Boost**🌟 - Use `!vote`" + args[1] += '\n\n' + upvote_info_formatted else: - args['content'] = "\n\nUpvote me to get 🌟**+25% Economy Boost**🌟 - Use `!vote`" + args['content'] = '\n\n' + upvote_info_formatted args = tuple(args) diff --git a/bot/modules/topgg/utils.py b/bot/modules/topgg/utils.py index f50c6da5..d4691730 100644 --- a/bot/modules/topgg/utils.py +++ b/bot/modules/topgg/utils.py @@ -12,7 +12,10 @@ from . import data as db from data.conditions import GEQ topgg_upvote_link = 'https://top.gg/bot/889078613817831495/vote' -remainder_content = "You can now Upvote me again in Top.gg. \nMy Upvote link is {}".format(topgg_upvote_link) +remainder_content = "You can now Upvote me again in Top.gg. \nMy Upvote link is [here]({})".format(topgg_upvote_link) + +lion_loveemote = '<:lionloveemote:933003977656795136>' +lion_yayemote = '<:lionyayemote:933003929229352990>' # Will return None if user has not voted in [-12.5hrs till now] # else will return a Tuple containing timestamp of when exactly she voted @@ -37,11 +40,14 @@ def create_remainder(userid): # if no, Create reminder reminder = Reminder.create( userid=userid, + # TODO using content as a selector is not a good method content=remainder_content, message_link=None, interval=None, - #remind_at=datetime.datetime.utcnow() + datetime.timedelta(minutes=2) - remind_at=last_vote_time[0] + datetime.timedelta(hours=12.5) if last_vote_time else datetime.datetime.utcnow() + datetime.timedelta(minutes=5) + title="Your boost is now available! {}".format(lion_yayemote), + footer="to stop reminders, use `{}vote_reminder off` command", + # remind_at=last_vote_time[0] + datetime.timedelta(hours=12.5) if last_vote_time else datetime.datetime.utcnow() + datetime.timedelta(minutes=5) + remind_at=datetime.datetime.utcnow() + datetime.timedelta(minutes=2) ) # Schedule reminder @@ -59,11 +65,12 @@ async def send_user_dm(userid): if user: try: embed=discord.Embed( - title="Thankyou.", - description='Thankyou for upvoting.', + title="Thank you for supporting our bot on Top.gg! {}".format(lion_yayemote), + description="By voting every 12 hours you will allow us to reach and help even more students all over the world.\n \ + Thank you for supporting us, enjoy your LionCoins boost!", colour=discord.Colour.orange() ).set_image( - url="https://cdn.discordapp.com/attachments/908283085999706153/930559064323268618/unknown.png" + url="https://cdn.discordapp.com/attachments/908283085999706153/932737228440993822/lion-yay.png" ) await user.send(embed=embed)