Browse Source

Add cooldown for the happening

master
pfero 6 years ago
parent
commit
24304b8b12
  1. 5
      bot.py

5
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):
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

Loading…
Cancel
Save