diff options
author | Joe Robinson <joe@lc8n.com> | 2021-12-09 00:25:56 +0000 |
---|---|---|
committer | Joe Robinson <joe@lc8n.com> | 2021-12-09 00:25:56 +0000 |
commit | b70601162893587ab5fc1afa781f38c390612e8a (patch) | |
tree | 093048fccb73664f41b573d4406fbaeee2341b23 /commands | |
parent | 4ba066e4807945d1d03e6f1c98451410c0c24e8f (diff) |
Update economy messages and rate
Diffstat (limited to 'commands')
-rw-r--r-- | commands/economy.py | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/commands/economy.py b/commands/economy.py index a2178c4..720a00d 100644 --- a/commands/economy.py +++ b/commands/economy.py @@ -1,5 +1,6 @@ from discord.ext.commands import Bot, Cog from discord_slash import cog_ext, SlashContext +from discord import Embed from base import config from models.user import User import datetime @@ -32,17 +33,21 @@ class Economy(Cog): f"now: {time_now}, day: {day_ago}, user: {user.exp_gained_time}, remaining: {remaining}" ) if user.daily_gained_time is None or user.daily_gained_time <= day_ago: - num_coins = random.randrange(50, 100) + num_coins = 10 + user.level * 2 user.daily_gained_time = time_now user.add_coins(num_coins) user.save() - await ctx.send( - content=f"Here you go {user.display_name}, have {num_coins} {config['currency']}" + embed = Embed( + description=f"Here you go {ctx.author.mention}, have your daily coins", + colour=0x00FF00, ) + embed.add_field(name="Gained:", value=f"{num_coins} {config['currency']}") else: - await ctx.send( - content=f"No {config['currency']} for you {user.display_name}, come back in {remaining.seconds // 3600} hours, {(remaining.seconds % 3600) // 60 } minutes." + embed = Embed( + description=f"No {config['currency']} for you {user.display_name}, come back in {remaining.seconds // 3600} hours, {(remaining.seconds % 3600) // 60 } minutes.", + colour=0xFF8800, ) + await ctx.send(embed=embed) @cog_ext.cog_slash( name="coins", @@ -51,9 +56,12 @@ class Economy(Cog): ) async def coins(self, ctx: SlashContext): user = User.get(User.discord_id == ctx.author_id) - await ctx.send( - content=f"{user.display_name}, you have {user.currency} {config['currency']}" + embed = Embed( + description=f"{ctx.author.mention}, here is your current balance:", + colour=0x0000FF, ) + embed.add_field(name="Currency:", value=f"{user.currency} {config['currency']}") + await ctx.send(embed=embed) @cog_ext.cog_slash( name="leaderboard", @@ -62,11 +70,18 @@ class Economy(Cog): ) async def leaderboard(self, ctx: SlashContext): users = User.select().order_by(User.currency.desc()).limit(10) - rank_text = "" + embed = Embed( + title="Currency Leaderboard", + colour=0x0000FF, + ) + i = 1 for user in users: - rank_text += f"{user.display_name}: {user.currency} {config['currency']} \n" + embed.add_field( + name=f"#{i} {user.display_name}", value=f"{user.currency} {config['currency']}" + ) + i += 1 - await ctx.send(content=rank_text) + await ctx.send(embed=embed) def setup(bot): |