Trying to get errorFunction to work

pull/2/head
sgoudham 5 years ago
parent 3a8657f21a
commit 1be066ec59

@ -1,3 +1,4 @@
import asyncio
import datetime import datetime
import random import random
@ -40,9 +41,13 @@ class Embeds(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
else: else:
message = 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()
#
except FileNotFoundError as e: except FileNotFoundError as e:
print(e) print(e)
@ -70,8 +75,12 @@ class Embeds(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
else: else:
message = error_function()
await errorFunction() # 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)
@ -100,8 +109,12 @@ class Embeds(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
else: else:
message = error_function()
await errorFunction() # 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)
@ -130,15 +143,15 @@ class Embeds(commands.Cog):
await ctx.send(embed=embed) await ctx.send(embed=embed)
else: else:
await errorFunction() message = 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)
def errorFunction():
return error_function()
def setup(bot): def setup(bot):
bot.add_cog(Embeds(bot)) bot.add_cog(Embeds(bot))

@ -1,3 +1,4 @@
import asyncio
import random import random
import discord import discord
@ -5,7 +6,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.Embeds import errorFunction from EnsoBot import error_function
colour_list = [c for c in config.colors.values()] colour_list = [c for c in config.colors.values()]
@ -117,7 +118,12 @@ class Fun(commands.Cog):
else: else:
await errorFunction() message = 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)

@ -1,3 +1,4 @@
import asyncio
import datetime import datetime
import random import random
import string import string
@ -7,7 +8,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 from EnsoBot import error_function
channels = ["enso-chan-commands"] channels = ["enso-chan-commands"]
@ -41,7 +42,12 @@ class Waifus(commands.Cog):
else: else:
await errorFunction() message = 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)
@ -69,7 +75,12 @@ class Waifus(commands.Cog):
else: else:
await errorFunction() message = 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)
@ -96,7 +107,12 @@ class Waifus(commands.Cog):
else: else:
await errorFunction() message = 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)

Loading…
Cancel
Save