From e099a3d260719cf40912fe173568654e45e0dc2d Mon Sep 17 00:00:00 2001 From: fretuks Date: Wed, 10 Dec 2025 09:22:12 +0100 Subject: [PATCH] Small fix to chat revive --- helper_moderation.py | 2 ++ tars_bot.py | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/helper_moderation.py b/helper_moderation.py index 0e109aa..faab0d4 100644 --- a/helper_moderation.py +++ b/helper_moderation.py @@ -27,6 +27,8 @@ async def handle_moderation(message): return if is_user_immune(message.author): return + if message.guild is None: + return text = message.content or "" uid = str(message.author.id) g = message.guild diff --git a/tars_bot.py b/tars_bot.py index 5dbd840..5249e1c 100644 --- a/tars_bot.py +++ b/tars_bot.py @@ -296,7 +296,7 @@ async def on_ready(): logger.info(f"T.A.R.S. is online as {bot.user} (ID: {bot.user.id})") scheduler.start() scheduler.add_job( - lambda: asyncio.create_task(check_chat_revive()), + lambda: bot.loop.create_task(check_chat_revive()), "interval", minutes=10, id="chat_revive_job", @@ -826,8 +826,8 @@ async def check_chat_revive(): avoid_text = "" if recent_questions: avoid_text = ( - "Avoid reusing or closely paraphrasing these recent questions:\n" - + "\n".join(f"- {q}" for q in recent_questions) + "Avoid reusing or closely paraphrasing these recent questions:\n" + + "\n".join(f"- {q}" for q in recent_questions) ) prompt = ( "Generate a short, friendly, thought-provoking conversation starter "