Skip to content

Commit

Permalink
Update slots.py
Browse files Browse the repository at this point in the history
added a 3 second cooldown to the slots command
  • Loading branch information
DanielOrourke02 authored May 17, 2024
1 parent fda07a1 commit 192f918
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/slots.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def check_bet(self, ctx, bet):


@commands.command(brief='Slot machine', usage='slots *[bet]', aliases=['slot'])
@commands.cooldown(1, 3, BucketType.user)
async def slots(self, ctx: commands.Context, bet: int=None):
if self.check_bet(ctx, bet=bet) is False:
embed = discord.Embed(
Expand Down Expand Up @@ -125,6 +126,18 @@ async def slots(self, ctx: commands.Context, bet: int=None):
await message.edit(content=None, embed=embed)

os.remove(fp)

@slots.error
async def slots_error(self, ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = discord.Embed(
title="Slots Cooldown!",
description=f"{ctx.author.mention}, woah slow down there buddy! The slot can run again in {error.retry_after:.2f} seconds.",
color=discord.Color.red()
)
embed.set_footer(text="Made by mal023")
await ctx.send(embed=embed)



@commands.Cog.listener()
Expand Down

0 comments on commit 192f918

Please sign in to comment.