diff --git a/bot.py b/bot.py index a1a3749..4ce43ed 100644 --- a/bot.py +++ b/bot.py @@ -5,6 +5,7 @@ from os import listdir from os.path import splitext, basename from urllib.parse import urlparse from asyncio import Lock +from datetime import datetime, timedelta def url(str): try: @@ -23,6 +24,8 @@ class Client(discord.Client): print("Logged on as", self.user) self.emoji_lock = Lock() + self.lastime = None + async def on_message(self, message): if message.author == self.user: return @@ -32,7 +35,9 @@ class Client(discord.Client): lowermsg = message.content.lower() if "why" in lowermsg and ("happening" in lowermsg or "habbening" in lowermsg): - await message.channel.send("https://i.imgur.com/SFRw7aJ.png") # seedot.png + if not self.lastime or self.lastime + timedelta(hours=1) < datetime.now(): + await message.channel.send("https://i.imgur.com/SFRw7aJ.png") # seedot.png + self.lastime = datetime.now() name = None image_name = None