hebdobot/bot/hooks/current.py

32 lines
999 B
Python

import logger
class Current:
def process(self, bot, channel, sender, message):
"""
Si la commande est bonne, le bot renvoie le sujet courant, s'il existe.
"""
if message.lower() == "!courant":
logger.info("!courant caught.")
if not bot.review.is_started:
bot.send(channel, f"{sender}, pas de revue en cours.")
return True
if not bot.review.current_topic:
bot.send(channel, "% Pas de sujet en cours.")
return True
if bot.review.current_topic.collective:
bot.send(
channel,
f"% Sujet collectif en cours : {bot.review.current_topic.title}",
)
return True
else:
bot.send(
channel,
f"% Sujet individuel en cours : {bot.review.current_topic.title}",
)
return True