From c3645b916781b5c75ce58f42e5b8ad9f137bc3eb Mon Sep 17 00:00:00 2001 From: Vasily Zubarev Date: Wed, 13 Nov 2024 14:53:58 +0100 Subject: [PATCH] fix: support /skip for comments --- bot/handlers/comments.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bot/handlers/comments.py b/bot/handlers/comments.py index 94bc16923..be638c21d 100644 --- a/bot/handlers/comments.py +++ b/bot/handlers/comments.py @@ -16,6 +16,7 @@ log = logging.getLogger(__name__) MIN_COMMENT_LEN = 40 +SKIP_COMMANDS = ("/skip", "#skip", "#ignore") def comment(update: Update, context: CallbackContext) -> None: @@ -72,6 +73,10 @@ def reply_to_comment(update: Update, context: CallbackContext) -> None: ) return None + for skip_word in SKIP_COMMANDS: + if skip_word in text: + return None + # max 3 levels of comments are allowed reply_to_id = comment.id if comment.reply_to_id and comment.reply_to.reply_to_id: @@ -136,7 +141,7 @@ def comment_to_post(update: Update, context: CallbackContext) -> None: ) return None - for skip_word in ("/skip","#skip","#ignore"): + for skip_word in SKIP_COMMANDS: if skip_word in text: return None