Trying to get cooldown working

pull/2/head
sgoudham 5 years ago
parent 90fb4e17e1
commit 81041cf305

@ -97,12 +97,6 @@ def displayAnimeImage(array, msg, name):
return anime_embed
def timeDif(self):
time_difference = (datetime.datetime.utcnow() - self.last_timeStamp).total_seconds()
if time_difference <= 1:
return f"Sorry! This command is still on cooldown! Try again in {time_difference} seconds!"
class Waifus(commands.Cog):
def __init__(self, bot):
self.bot = bot
@ -235,7 +229,11 @@ class Waifus(commands.Cog):
# Makes sure that the user wants a random image of a waifu
if 'w random' in user_msg:
timeDif(self)
time_difference = (datetime.datetime.utcnow() - self.last_timeStamp).total_seconds()
if time_difference <= 1:
await channel.send(
f"Sorry! This command is still on cooldown! Try again in {time_difference} seconds!")
return
# Get embed from randomWaifu() and send it to the channel
embed = randomWaifu(message, waifu_array)
@ -244,7 +242,11 @@ class Waifus(commands.Cog):
# Makes sure that the user wants a specific image of a waifu
elif user_msg.startswith('~w'):
timeDif(self)
time_difference = (datetime.datetime.utcnow() - self.last_timeStamp).total_seconds()
if time_difference <= 1:
await channel.send(
f"Sorry! This command is still on cooldown! Try again in {time_difference} seconds!")
return
# Define who the waifu is using string splitting
waifu_split_msg = user_msg.split("w ", 1)

Loading…
Cancel
Save