1
Fork 0
mirror of https://github.com/wlinator/luminara.git synced 2024-10-03 02:23:13 +00:00
Lumi/modules/economy/stats.py

49 lines
1.9 KiB
Python
Raw Normal View History

from config.parser import JsonCache
2024-06-20 10:34:03 +00:00
from services.currency_service import Currency
2024-06-20 17:48:49 +00:00
from services.stats_service import BlackJackStats, SlotsStats
strings = JsonCache.read_json("strings")
resources = JsonCache.read_json("resources")
2024-03-29 17:17:51 +00:00
async def cmd(self, ctx, game):
output = ""
if game == "BlackJack":
stats = BlackJackStats.get_user_stats(ctx.author.id)
# amount formatting
total_bet = Currency.format_human(stats["total_bet"])
total_payout = Currency.format_human(stats["total_payout"])
2024-06-15 22:45:24 +00:00
# output = f"{ctx.author.name}'s lumi stats\n\n"
output = strings["stats_blackjack"].format(
stats["amount_of_games"],
total_bet,
stats["winning_amount"],
total_payout
)
elif game == "Slots":
stats = SlotsStats.get_user_stats(ctx.author.id)
# amount formatting
total_bet = Currency.format_human(stats["total_bet"])
total_payout = Currency.format_human(stats["total_payout"])
output = strings["stats_slots"].format(stats["amount_of_games"], total_bet, total_payout)
output += "\n\n"
pair_emote = self.client.get_emoji(resources["slots"]["emotes"]["slots_0_id"])
three_emote = self.client.get_emoji(resources["slots"]["emotes"]["slots_4_id"])
diamonds_emote = self.client.get_emoji(resources["slots"]["emotes"]["slots_5_id"])
seven_emote = self.client.get_emoji(resources["slots"]["emotes"]["slots_6_id"])
output += f"{pair_emote} | **{stats['games_won_pair']}** pairs.\n"
output += f"{three_emote} | **{stats['games_won_three_of_a_kind']}** three-of-a-kinds.\n"
output += f"{diamonds_emote} | **{stats['games_won_three_diamonds']}** triple diamonds.\n"
output += f"{seven_emote} | **{stats['games_won_jackpot']}** jackpots."
output += "\n\n *This command is still in beta, stats may be slightly inaccurate.*"
await ctx.respond(content=output)