Added an event for any missing arguments

testing
sgoudham 5 years ago
parent b8a0b164e3
commit 79f341dc09

@ -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:

@ -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!"

@ -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()

Loading…
Cancel
Save