From 52e25c5de1d4fbd96f233eca582f2d9c949a2789 Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Mon, 15 Apr 2024 19:50:17 +0100 Subject: [PATCH] Log truth counting --- src/cogs/quote_quota.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cogs/quote_quota.py b/src/cogs/quote_quota.py index ae8bab7..a33f8bf 100644 --- a/src/cogs/quote_quota.py +++ b/src/cogs/quote_quota.py @@ -1,4 +1,5 @@ import asyncio +import logging import re import discord @@ -17,6 +18,7 @@ class QuoteQuota(commands.Cog): self.bot = bot self.quotes_channel_id = CONFIG["quote_a"].get("channel_id") self.names = CONFIG["quote_a"].get("names", {}) + self.log = logging.getLogger("jimmy.cogs.quote_quota") @property def quotes_channel(self) -> discord.TextChannel | None: @@ -202,6 +204,8 @@ class QuoteQuota(commands.Cog): } for message in messages: if filter_func(message): + age = now - message.created_at + self.log.info("%r was a truth (%.2f seconds ago).", message, age.total_seconds()) counts["all_time"] += 1 if message.created_at > now - timedelta(hours=1): counts["hour"] += 1 @@ -213,6 +217,7 @@ class QuoteQuota(commands.Cog): counts["per_minute"] = counts["hour"] / 60 counts["per_hour"] = counts["day"] / 24 counts["per_day"] = counts["week"] / 7 + self.log.info("Total truth counts: %r", counts) return counts async def _process_trump_truths(self, messages: list[discord.Message]) -> dict[str, int]: