forked from mindiell/hebdobot
27 lines
761 B
Python
27 lines
761 B
Python
|
import locale
|
||
|
|
||
|
import logger
|
||
|
from bot.review.stats import ReviewStats
|
||
|
|
||
|
|
||
|
class Record:
|
||
|
def process(self, bot, channel, sender, message):
|
||
|
"""
|
||
|
Si la commande est bonne, le bot renvoie le record de participation à la revue.
|
||
|
"""
|
||
|
if message.lower() == "!record":
|
||
|
logger.info("!record caught.")
|
||
|
|
||
|
locale.setlocale(locale.LC_ALL, "fr_FR.utf8")
|
||
|
formatter = "%A %d %B %Y"
|
||
|
stats = ReviewStats(bot.settings.REVIEW_STATS)
|
||
|
stats.load()
|
||
|
|
||
|
bot.send(
|
||
|
channel,
|
||
|
f"Le record de participation est de {stats.biggest.user_count} "
|
||
|
f"personnes le {stats.biggest.date.strftime(formatter)}.",
|
||
|
)
|
||
|
|
||
|
return True
|