diff --git a/EnsoBot.py b/EnsoBot.py index a718322d..ce57a5e7 100644 --- a/EnsoBot.py +++ b/EnsoBot.py @@ -198,6 +198,11 @@ async def on_raw_reaction_remove(payload): print(e) +# Error handling function to make sure that the commands only work in enso-chan-commands +def error_function(): + return "Sorry! I only work in #enso-chan-commands!" + + # Run the bot, allowing to come online try: client.run(API_TOKEN) diff --git a/cogs/Embeds.py b/cogs/Embeds.py index 8f150da2..0e974cb5 100644 --- a/cogs/Embeds.py +++ b/cogs/Embeds.py @@ -7,7 +7,7 @@ from discord.ext import commands from discord.ext.commands import BucketType, cooldown import config -from cogs.FunCommands import error_function +from EnsoBot import error_function colour_list = [c for c in config.colors.values()] channels = ["enso-chan-commands", 'general'] @@ -42,12 +42,8 @@ class Embeds(commands.Cog): else: - message = await ctx.send(error_function()) - - # Let the user read the message for 2.5 seconds - await asyncio.sleep(2.5) - # Delete the message - await message.delete() + await errorFunction(ctx) + # except FileNotFoundError as e: print(e) @@ -76,12 +72,8 @@ class Embeds(commands.Cog): else: - message = await ctx.send(error_function()) + await errorFunction(ctx) - # Let the user read the message for 2.5 seconds - await asyncio.sleep(2.5) - # Delete the message - await message.delete() except FileNotFoundError as e: print(e) @@ -110,12 +102,8 @@ class Embeds(commands.Cog): else: - message = await ctx.send(error_function()) + await errorFunction(ctx) - # Let the user read the message for 2.5 seconds - await asyncio.sleep(2.5) - # Delete the message - await message.delete() except FileNotFoundError as e: print(e) @@ -143,16 +131,20 @@ class Embeds(commands.Cog): await ctx.send(embed=embed) else: + await errorFunction(ctx) - message = await ctx.send(error_function()) - - # Let the user read the message for 2.5 seconds - await asyncio.sleep(2.5) - # Delete the message - await message.delete() except FileNotFoundError as e: print(e) +async def errorFunction(ctx): + message = await ctx.send(error_function()) + + # 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(Embeds(bot)) diff --git a/cogs/FunCommands.py b/cogs/FunCommands.py index 51160b23..7d876360 100644 --- a/cogs/FunCommands.py +++ b/cogs/FunCommands.py @@ -1,4 +1,3 @@ -import asyncio import random import discord @@ -6,7 +5,7 @@ from discord.ext import commands from discord.ext.commands import BucketType, cooldown import config -from cogs.WaifuImages import error_function +from cogs.Embeds import errorFunction colour_list = [c for c in config.colors.values()] @@ -118,12 +117,7 @@ class Fun(commands.Cog): else: - message = await ctx.send(error_function()) - - # Let the user read the message for 2.5 seconds - await asyncio.sleep(2.5) - # Delete the message - await message.delete() + await errorFunction(ctx) except FileNotFoundError as e: print(e) diff --git a/cogs/HelpCommands.py b/cogs/HelpCommands.py index a553173d..bf639743 100644 --- a/cogs/HelpCommands.py +++ b/cogs/HelpCommands.py @@ -59,6 +59,12 @@ class CustomHelp(commands.Cog): "\n Allows the user to throw an insult to someone in the server" + "\n *(Perms: Co-Owner)*", inline=True) + embed.add_field( + name="\u200b", + value="**➳ ~slap**" + + "\n Allows the user to slap someone in the server" + + "\n *(Perms: Everyone)*", + inline=True) embed.add_field( name="\u200b", value="**➳ ~compliment**" + diff --git a/cogs/WaifuImages.py b/cogs/WaifuImages.py index 162e5074..dd8e33fb 100644 --- a/cogs/WaifuImages.py +++ b/cogs/WaifuImages.py @@ -1,4 +1,3 @@ -import asyncio import datetime import random import string @@ -8,6 +7,7 @@ from discord.ext import commands from discord.ext.commands import cooldown, BucketType import config +from cogs.Embeds import errorFunction channels = ["enso-chan-commands"] @@ -41,12 +41,7 @@ class Waifus(commands.Cog): else: - message = await ctx.send(error_function()) - - # Let the user read the message for 2.5 seconds - await asyncio.sleep(2.5) - # Delete the message - await message.delete() + await errorFunction(ctx) except FileNotFoundError as e: print(e) @@ -74,12 +69,7 @@ class Waifus(commands.Cog): else: - message = await ctx.send(error_function()) - - # Let the user read the message for 2.5 seconds - await asyncio.sleep(2.5) - # Delete the message - await message.delete() + await errorFunction(ctx) except FileNotFoundError as e: print(e) @@ -106,12 +96,8 @@ class Waifus(commands.Cog): else: - message = await ctx.send(error_function()) + await errorFunction(ctx) - # Let the user read the message for 2.5 seconds - await asyncio.sleep(2.5) - # Delete the message - await message.delete() except FileNotFoundError as e: print(e) @@ -176,11 +162,6 @@ def displayServerImage(array, ctx, name): return embed -# Error handling function to make sure that the commands only work in bot-commands -def error_function(): - return "Sorry! I only work in #enso-chan-commands!" - - def setup(bot): bot.add_cog(Waifus(bot))