hebdobot/hooks/date.py

18 lines
489 B
Python

from datetime import datetime
import locale
import logger
class Date:
def process(self, bot, channel, sender, message):
"""
Si la commande est bonne, le bot renvoie la date et l'heure actuelle.
"""
if message.lower() in ("!date", "!time", "!now"):
logger.info("!date caught.")
locale.setlocale(locale.LC_ALL, "fr_FR.utf8")
bot.send(channel, datetime.today().strftime("%A %d %B %Y %Hh%M"))
return True