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

54 lines
2 KiB
Python

from config.parser import JsonCache
from services.currency_service import Currency
from services.stats_service import BlackJackStats, SlotsStats
strings = JsonCache.read_json("strings")
resources = JsonCache.read_json("resources")
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"])
# 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)