1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-02 20:23:12 +00:00

refactor balance command

This commit is contained in:
wlinator 2024-08-22 23:02:02 +02:00
parent 774aec7f84
commit af7f3901fc
2 changed files with 16 additions and 9 deletions

View file

@ -281,5 +281,8 @@
"xp_lb_field_value": "level: **{0}**\nxp: `{1}/{2}`",
"xp_level": "Level {0}",
"xp_progress": "Progress to next level",
"xp_server_rank": "Server Rank: #{0}"
"xp_server_rank": "Server Rank: #{0}",
"balance_cash": "**Cash**: ${0}",
"balance_author": "{0}'s wallet",
"balance_footer": "Check out /daily"
}

View file

@ -1,18 +1,22 @@
import discord
from discord.ext import commands
from services.currency_service import Currency
from lib.constants import CONST
from lib.embed_builder import EmbedBuilder
async def cmd(ctx):
# Currency handler
async def cmd(ctx: commands.Context[commands.Bot]) -> None:
ctx_currency = Currency(ctx.author.id)
balance = Currency.format(ctx_currency.balance)
embed = discord.Embed(
color=discord.Color.embed_background(),
description=f"**Cash**: ${balance}",
embed = EmbedBuilder.create_success_embed(
ctx,
author_text=CONST.STRINGS["balance_author"].format(ctx.author.name),
author_icon_url=ctx.author.display_avatar.url,
description=CONST.STRINGS["balance_cash"].format(balance),
footer_text=CONST.STRINGS["balance_footer"],
show_name=False,
hide_timestamp=True,
)
embed.set_author(name=f"{ctx.author.name}'s wallet", icon_url=ctx.author.avatar.url)
await ctx.respond(embed=embed)