hebdobot/hooks/date.py

18 lines
489 B
Python
Raw Normal View History

2024-01-11 08:17:25 +01:00
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