From bac2a0fbb31b01f628c040ccfd3aef0aefc480b7 Mon Sep 17 00:00:00 2001 From: fretuks Date: Tue, 4 Nov 2025 14:38:24 +0100 Subject: [PATCH] Small fix to link handling --- tars_bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tars_bot.py b/tars_bot.py index 4ab080a..97ee01b 100644 --- a/tars_bot.py +++ b/tars_bot.py @@ -95,7 +95,7 @@ def is_inappropriate(text: str) -> bool: def strip_links(text: str) -> str: - return re.sub(r'https?://\S+', '[LINK REMOVED]', text) + return re.sub(r'http?://\S+', '[LINK REMOVED]', text) async def init_db(): @@ -524,7 +524,7 @@ async def on_message(message: discord.Message): ][-5:] reply = await tars_ai_respond(last_message, message.author.display_name, context_messages, user=message.author) - link_count = len(re.findall(r'https?://\S+', reply)) + link_count = len(re.findall(r'http?://\S+', reply)) if link_count > 0: logger.warning(f"Blocked AI response containing {link_count} links: {reply}") await message.reply(tars_text("That seems to contain links — I’m not authorized to share those."))