Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jackra1n committed Dec 10, 2023
1 parent 4c15ed9 commit 474fc5e
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions bot/cogs/karma.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ def __init__(self, ctx: commands.Context, kasino: Record):
super().__init__(timeout=None)
self.ctx = ctx
self.kasino = kasino
self.add_item(KasinoBetButton(ctx, kasino))


class KasinoBetButton(ui.Button):
Expand Down Expand Up @@ -923,25 +924,16 @@ async def on_submit(self, interaction: discord.Interaction) -> None:
if amount < 1:
return await interaction.response.send_message('You tried to bet < 1 karma! Silly you!', ephemeral=True)

kasino = await self.bot.db.fetchrow('SELECT * FROM kasino WHERE id = $1', kasino_id)

if kasino is None:
output_embed.title=f'Kasino with ID {kasino_id} is not open.'
return await ctx.author.send(embed=output_embed, delete_after=30)
if self.kasino['locked']:
return await interaction.response.send_message('The kasino is locked! No more bets are taken in. Time to wait and see...', ephemeral=True)

if kasino['locked']:
output_embed.title=f'kasino with ID {kasino_id} is locked.'
return await ctx.author.send(embed=output_embed, delete_after=30)

bettor_karma = await self._get_user_karma(ctx.author.id, ctx.guild.id)
bettor_karma = await self._get_user_karma(interaction.user.id, interaction.guild.id)
if bettor_karma is None:
return await ctx.send('You do not have any karma.')
return await interaction.response.send_message('You don\'t have any karma!', ephemeral=True)

amount = bettor_karma if amount == "all" else amount

if bettor_karma < amount:
output_embed.title=f'You don\'t have that much karma. Your karma: {bettor_karma}'
return await ctx.author.send(embed=output_embed, delete_after=30)
return await interaction.response.send_message('You don\'t have enough karma!', ephemeral=True)

total_bet = amount
output = 'added'
Expand Down

0 comments on commit 474fc5e

Please sign in to comment.