From c9247270d798b290293d53c42405962591eea468 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Sun, 21 Jun 2020 23:24:58 +0100 Subject: [PATCH] Added more commentary --- cogs/OwOText.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cogs/OwOText.py b/cogs/OwOText.py index f31bf337..a0831a60 100644 --- a/cogs/OwOText.py +++ b/cogs/OwOText.py @@ -2,7 +2,7 @@ import random from discord.ext import commands # OwO Impowt da wibwawy ÙωÙ -from discord.ext.commands import cooldown, BucketType +from discord.ext.commands import BucketType from owotext import OwO # Defining an array of all the vowels in lowercase and uppercase @@ -44,7 +44,7 @@ class OwOText(commands.Cog): # ~owo command allows for text to be 'converted to OWO' @commands.command() - @cooldown(1, 1, BucketType.user) + @commands.cooldown(1, 1, BucketType.user) async def owo(self, ctx): if ctx.message.content.startswith("~owo"): msg = ctx.message.content.split("~owo ", 1) @@ -55,5 +55,18 @@ class OwOText(commands.Cog): await ctx.message.channel.send(owo) +""" # Bot Event for handling cooldown error + @commands.Cog.listener() + async def on_command_error(self, ctx, error): + if isinstance(error, commands.CommandOnCooldown): + message = await ctx.send(f'That command is on cooldown. Try again in {error.retry_after:,.2f} seconds.') + + # Let the user read the message for 2.5 seconds + await asyncio.sleep(2.5) + # Delete the message + await message.delete() +""" + + def setup(bot): bot.add_cog(OwOText(bot))