Skip to content

Commit

Permalink
fix: support /skip for comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vas3k committed Nov 13, 2024
1 parent fc2b88c commit c3645b9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bot/handlers/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
log = logging.getLogger(__name__)

MIN_COMMENT_LEN = 40
SKIP_COMMANDS = ("/skip", "#skip", "#ignore")


def comment(update: Update, context: CallbackContext) -> None:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit c3645b9

Please sign in to comment.