hebdobot/hooks/individual_subject.py

46 lines
1.8 KiB
Python
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import re
import logger
class IndividualSubject:
def process(self, bot, channel, sender, message):
"""
Si la commande est bonne, le bot démarre un nouveau sujet individuel.
"""
if re.match("^\s*#[^#].*$", message):
logger.info("^\s*#[^#].*$ caught.")
if bot.review.is_started:
if bot.review.is_owner(sender):
# On lance un nouveau sujet individuel
bot.review.new_individual_topic(message.strip()[1:].strip())
# S'il y avait un ancien sujet, on le signale
if bot.review.last_topic:
bot.review.last_topic.close()
bot.send(
channel,
f"% durée du point {bot.review.last_topic.title} : "
f"{bot.review.last_topic.duration}",
)
# Et on prévient les participants
bot.send(
channel,
f"% {' '.join(bot.review.participants)}, on va passer à la "
f"suite : {bot.review.current_topic.title}",
)
# Et on signale le démarrage du sujet
bot.send(
channel,
f"Sujet individuel : {bot.review.current_topic.title}",
)
bot.send(channel, "% si rien à signaler vous pouvez écrire % ras")
bot.send(channel, "% quand vous avez fini vous le dites par % fini")
else:
bot.send(
channel,
f"{sender}, vous n'êtes pas responsable de la réunion",
)
return True