This commit is contained in:
2023-05-05 17:44:48 +02:00
parent 1a40ffb4a6
commit b60a78e75a
8 changed files with 564 additions and 15 deletions
+8
View File
@@ -12,6 +12,7 @@ class SlashRoll(commands.Cog):
print("SlashRoll.py is ready")
@app_commands.command(name="roll", description="Rolls a number between 1 and 100 with a rating")
@app_commands.checks.cooldown(1, 600)
async def slashroll(self, interaction: discord.Interaction):
rolled = random.randint(1,100)
rating = ""
@@ -39,6 +40,13 @@ class SlashRoll(commands.Cog):
await interaction.response.send_message(message)
@slashroll.error
async def on_command_error(self, interaction: discord.Interaction, error : app_commands.AppCommandError):
if isinstance(error, app_commands.CommandOnCooldown):
time = round(error.retry_after/60)
message = f"This command is on cooldown, the cooldown ends in {time} minutes"
await interaction.response.send_message(message)
async def setup(client):
await client.add_cog(SlashRoll(client))