Finalize Topgg bot messages

This commit is contained in:
Harsha Raghu
2022-01-18 21:14:05 +05:30
parent 19816198b0
commit 417e31c7ab
3 changed files with 26 additions and 13 deletions

View File

@@ -5,6 +5,7 @@ from bot.cmdClient.checks.global_perms import in_guild
from settings.user_settings import UserSettings from settings.user_settings import UserSettings
from .webhook import on_dbl_vote from .webhook import on_dbl_vote
from .utils import *
@module.cmd( @module.cmd(
"forcevote", "forcevote",
@@ -50,11 +51,11 @@ async def cmd_vote(ctx):
target = ctx.author target = ctx.author
embed=discord.Embed( embed=discord.Embed(
title="Topgg Upvote", title="Claim your boost!",
description='Please click [here](https://top.gg/bot/889078613817831495/vote) to upvote.\n\nThanks.', 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() colour=discord.Colour.orange()
).set_thumbnail( ).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) return await ctx.reply(embed=embed)

View File

@@ -8,6 +8,8 @@ from .webhook import init_webhook
module = LionModule("Topgg") module = LionModule("Topgg")
upvote_info = "You have a boost available {}, to support our project and earn **25% more LionCoins** type `{}vote` {}"
@module.launch_task @module.launch_task
async def register_hook(client): async def register_hook(client):
init_webhook() init_webhook()
@@ -28,20 +30,23 @@ def reply(util_func, *args, **kwargs):
if not get_last_voted_timestamp(args[0].author.id): if not get_last_voted_timestamp(args[0].author.id):
args = list(args) args = list(args)
upvote_info_formatted = upvote_info.format(lion_yayemote, args[0].best_prefix, lion_loveemote)
if 'embed' in kwargs: if 'embed' in kwargs:
kwargs['embed'].add_field( kwargs['embed'].add_field(
name="\u200b", name="\u200b",
value=( value=(
f"Upvote me to get 🌟**+25% Economy Boost**🌟 - Use `!vote`" upvote_info_formatted
), ),
inline=False inline=False
) )
elif 'content' in args and args['content']: 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: elif len(args) > 1:
args[1] += "\n\nUpvote me to get 🌟**+25% Economy Boost**🌟 - Use `!vote`" args[1] += '\n\n' + upvote_info_formatted
else: else:
args['content'] = "\n\nUpvote me to get 🌟**+25% Economy Boost**🌟 - Use `!vote`" args['content'] = '\n\n' + upvote_info_formatted
args = tuple(args) args = tuple(args)

View File

@@ -12,7 +12,10 @@ from . import data as db
from data.conditions import GEQ from data.conditions import GEQ
topgg_upvote_link = 'https://top.gg/bot/889078613817831495/vote' 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] # 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 # else will return a Tuple containing timestamp of when exactly she voted
@@ -37,11 +40,14 @@ def create_remainder(userid):
# if no, Create reminder # if no, Create reminder
reminder = Reminder.create( reminder = Reminder.create(
userid=userid, userid=userid,
# TODO using content as a selector is not a good method
content=remainder_content, content=remainder_content,
message_link=None, message_link=None,
interval=None, interval=None,
#remind_at=datetime.datetime.utcnow() + datetime.timedelta(minutes=2) title="Your boost is now available! {}".format(lion_yayemote),
remind_at=last_vote_time[0] + datetime.timedelta(hours=12.5) if last_vote_time else datetime.datetime.utcnow() + datetime.timedelta(minutes=5) 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 # Schedule reminder
@@ -59,11 +65,12 @@ async def send_user_dm(userid):
if user: if user:
try: try:
embed=discord.Embed( embed=discord.Embed(
title="Thankyou.", title="Thank you for supporting our bot on Top.gg! {}".format(lion_yayemote),
description='Thankyou for upvoting.', 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() colour=discord.Colour.orange()
).set_image( ).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) await user.send(embed=embed)