summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commands/economy.py35
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):