From 0effb60e58a15c8e0022028b13e0c0335e58f563 Mon Sep 17 00:00:00 2001 From: jetsparrow Date: Sun, 5 Apr 2026 22:08:41 +0300 Subject: [PATCH] Fix unbleeper triggering on bot commands --- Jetsparrow.Aasb/Language.cs | 2 ++ Jetsparrow.Aasb/Services/Unbleeper.cs | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Jetsparrow.Aasb/Language.cs b/Jetsparrow.Aasb/Language.cs index 68291de..27940f9 100644 --- a/Jetsparrow.Aasb/Language.cs +++ b/Jetsparrow.Aasb/Language.cs @@ -52,11 +52,13 @@ public static class StringEx => a == b || !char.IsLetterOrDigit(a) || !char.IsLetterOrDigit(b); static readonly Regex MentionRegex = new Regex("^@[a-zA-Z0-9_]+$", RegexOptions.Compiled); + static readonly Regex TelegramCommandRegex = new Regex("^/[a-zA-Z0-9_]+@?[a-zA-Z0-9_]*", RegexOptions.Compiled); static readonly Regex EmailPartRegex = new Regex("^\\w+@\\w+$", RegexOptions.Compiled); static readonly Regex HashTagRegex = new Regex("^#\\w+$", RegexOptions.Compiled); public static bool IsTelegramMention(string word) => MentionRegex.IsMatch(word); + public static bool IsTelegramCommand(string word) => TelegramCommandRegex.IsMatch(word); public static bool IsEmailPart(string word) => EmailPartRegex.IsMatch(word); diff --git a/Jetsparrow.Aasb/Services/Unbleeper.cs b/Jetsparrow.Aasb/Services/Unbleeper.cs index 5fbccdf..3e29b2a 100644 --- a/Jetsparrow.Aasb/Services/Unbleeper.cs +++ b/Jetsparrow.Aasb/Services/Unbleeper.cs @@ -26,6 +26,9 @@ public class Unbleeper if (string.IsNullOrWhiteSpace(text)) return null; + if (StringEx.IsTelegramCommand(text)) + return null; + text = text.Trim();