hebdobot/hooks/chrono.py

21 lines
646 B
Python
Raw Permalink Normal View History

2024-01-11 08:17:25 +01:00
from datetime import datetime
import logger
class Chrono:
def process(self, bot, channel, sender, message):
"""
Si la commande est bonne, le bot renvoie le chrono actuel.
"""
if message.lower() == "!chrono":
logger.info("!chrono caught.")
if bot.review.is_started:
# TODO: Faire comme l'ancien bot
seconds = (datetime.today() - bot.review.start_time).seconds
bot.send(channel, f"{seconds // 60:02d}:{seconds % 60:02d}")
return True
else:
bot.send(channel, "n/a")
return True