diff --git a/EnsoBot.py b/EnsoBot.py index 0af50f7a..aab68aa3 100644 --- a/EnsoBot.py +++ b/EnsoBot.py @@ -75,17 +75,6 @@ async def on_command_error(ctx, error): await message.delete() -@client.event -async def on_command_error(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() - - try: client.run(API_TOKEN) except discord.errors.LoginFailure as e: diff --git a/cogs/FunCommands.py b/cogs/FunCommands.py index 1f165ba5..d64d1b99 100644 --- a/cogs/FunCommands.py +++ b/cogs/FunCommands.py @@ -83,10 +83,9 @@ class Fun(commands.Cog): await ctx.send(random.choice(responses)) - # @client.command(aliases=["Hug"]) - # @commands.has_any_role('Hamothy') - # async def hug(self, ctx): - # await self.bot.say("hugs {}".format(ctx.message.author.mention())) + @commands.command(aliases=["Hug"]) + async def hug(self, ctx): + await self.bot.say("hugs {}".format(ctx.message.author.mention())) # Bot ~8Ball command @commands.command(aliases=['8ball', '8Ball']) @@ -110,6 +109,16 @@ class Fun(commands.Cog): # Delete the message await message.delete() + @commands.Cog.listener() + async def on_command_error(self, ctx, target: discord.member): + if isinstance(target, commands.MissingRequiredArgument): + message = await ctx.send("Uh oh! Couldn't find anyone to mention! Try again!") + + # Let the user read the message for 2.5 seconds + await asyncio.sleep(1.5) + # Delete the message + await message.delete() + def error_function(): return "Sorry! I only work in #bot-commands!" diff --git a/cogs/WaifuImages.py b/cogs/WaifuImages.py index a3b7b0b9..9e0d8210 100644 --- a/cogs/WaifuImages.py +++ b/cogs/WaifuImages.py @@ -17,7 +17,6 @@ class Waifus(commands.Cog): channels = ["bot-commands"] - # path = pathlib.Path(r'C:\Users\sgoud\PycharmProjects\EnsoBot\txtfiles\kakashiImages.txt') with open('kakashiImages.txt') as file: kakashi_array = file.readlines()