Allowed the error functions to be in EnsoBot.py

Added the ~slap command
pull/2/head
sgoudham 5 years ago
parent fe520fdb15
commit fe6e7dcb63

@ -198,6 +198,11 @@ async def on_raw_reaction_remove(payload):
print(e) 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 # Run the bot, allowing to come online
try: try:
client.run(API_TOKEN) client.run(API_TOKEN)

@ -7,7 +7,7 @@ from discord.ext import commands
from discord.ext.commands import BucketType, cooldown from discord.ext.commands import BucketType, cooldown
import config import config
from cogs.FunCommands import error_function from EnsoBot import error_function
colour_list = [c for c in config.colors.values()] colour_list = [c for c in config.colors.values()]
channels = ["enso-chan-commands", 'general'] channels = ["enso-chan-commands", 'general']
@ -42,12 +42,8 @@ class Embeds(commands.Cog):
else: 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: except FileNotFoundError as e:
print(e) print(e)
@ -76,12 +72,8 @@ class Embeds(commands.Cog):
else: 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: except FileNotFoundError as e:
print(e) print(e)
@ -110,12 +102,8 @@ class Embeds(commands.Cog):
else: 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: except FileNotFoundError as e:
print(e) print(e)
@ -143,16 +131,20 @@ class Embeds(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
else: 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: except FileNotFoundError as e:
print(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): def setup(bot):
bot.add_cog(Embeds(bot)) bot.add_cog(Embeds(bot))

@ -1,4 +1,3 @@
import asyncio
import random import random
import discord import discord
@ -6,7 +5,7 @@ from discord.ext import commands
from discord.ext.commands import BucketType, cooldown from discord.ext.commands import BucketType, cooldown
import config import config
from cogs.WaifuImages import error_function from cogs.Embeds import errorFunction
colour_list = [c for c in config.colors.values()] colour_list = [c for c in config.colors.values()]
@ -118,12 +117,7 @@ class Fun(commands.Cog):
else: 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: except FileNotFoundError as e:
print(e) print(e)

@ -59,6 +59,12 @@ class CustomHelp(commands.Cog):
"\n Allows the user to throw an insult to someone in the server" + "\n Allows the user to throw an insult to someone in the server" +
"\n *(Perms: Co-Owner)*", "\n *(Perms: Co-Owner)*",
inline=True) 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( embed.add_field(
name="\u200b", name="\u200b",
value="**➳ ~compliment**" + value="**➳ ~compliment**" +

@ -1,4 +1,3 @@
import asyncio
import datetime import datetime
import random import random
import string import string
@ -8,6 +7,7 @@ from discord.ext import commands
from discord.ext.commands import cooldown, BucketType from discord.ext.commands import cooldown, BucketType
import config import config
from cogs.Embeds import errorFunction
channels = ["enso-chan-commands"] channels = ["enso-chan-commands"]
@ -41,12 +41,7 @@ class Waifus(commands.Cog):
else: 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: except FileNotFoundError as e:
print(e) print(e)
@ -74,12 +69,7 @@ class Waifus(commands.Cog):
else: 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: except FileNotFoundError as e:
print(e) print(e)
@ -106,12 +96,8 @@ class Waifus(commands.Cog):
else: 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: except FileNotFoundError as e:
print(e) print(e)
@ -176,11 +162,6 @@ def displayServerImage(array, ctx, name):
return embed 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): def setup(bot):
bot.add_cog(Waifus(bot)) bot.add_cog(Waifus(bot))

Loading…
Cancel
Save