-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: implement blacklist * perf: improve code quality based on review * fix: lint black * chore: fix test and lint packages versions * Revert "chore: fix test and lint packages versions" This reverts commit c47e085. * fix: pipeline complains * docs: update changelog and readme * docs: fix auto-format mistake * test: add unit-tests for blacklist feature * test: minor updates * fix: lint black
- Loading branch information
Showing
8 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"""Anonym Comment on a post in the comment group""" | ||
|
||
from telegram import Update | ||
from telegram.ext import CallbackContext | ||
|
||
from spotted.data import Config | ||
from spotted.utils import EventInfo | ||
|
||
|
||
async def spam_comment_msg(update: Update, context: CallbackContext) -> None: | ||
"""Handles a spam comment on a post in the comment group. | ||
Deletes the original post. | ||
Args: | ||
update: update event | ||
context: context passed by the handler | ||
""" | ||
info = EventInfo.from_message(update, context) | ||
for message in Config.post_get("blacklist_messages"): | ||
if message in info.message.text: | ||
await info.message.delete() | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters