diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index a62af7f..f3e47af 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -1,32 +1,32 @@ # This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Python application - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -permissions: - contents: read - -jobs: - build: - - runs-on: debian-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.11 - uses: actions/setup-python@v3 - with: - python-version: "3.11" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements/common.txt +#name: Python application +# +#on: +# push: +# branches: [ "master" ] +# pull_request: +# branches: [ "master" ] +# +#permissions: +# contents: read +# +#jobs: +# build: +# +# runs-on: debian-latest +# +# steps: +# - uses: actions/checkout@v3 +# - name: Set up Python 3.11 +# uses: actions/setup-python@v3 +# with: +# python-version: "3.11" +# - name: Install dependencies +# run: | +# python -m pip install --upgrade pip +# pip install -r requirements/common.txt # - name: Test with unittest # run: | # python -m unittest discover -s tests diff --git a/src/commands.py b/src/commands.py index e40985f..fbd3918 100644 --- a/src/commands.py +++ b/src/commands.py @@ -42,9 +42,10 @@ async def moderate_messages(message: types.Message): increment(message.chat.id, banned=True) -@bot.message_handler(func=in_caption_spam_list, content_types=["video"], chat_types=["supergroup", "group"]) +@bot.edited_message_handler(func=in_caption_spam_list, content_types=["video", "photo", "animation"], chat_types=["supergroup", "group"]) +@bot.message_handler(func=in_caption_spam_list, content_types=["video", "photo", "animation"], chat_types=["supergroup", "group"]) async def catch_videos(message: types.Message): - """Catch offensive videos""" + """Catch offensive media""" await bot.delete_message(message.chat.id, message.id) await bot.ban_chat_member(message.chat.id, message.from_user.id) increment(message.chat.id, banned=True) diff --git a/src/filters.py b/src/filters.py index ac26c67..7e749b0 100644 --- a/src/filters.py +++ b/src/filters.py @@ -22,7 +22,7 @@ def in_caption_spam_list(message: types.Message) -> bool: """Check for mentioning unwanted words in caption.""" if message.caption and is_ban_words_in_caption(message.caption): from_user_id, title, from_user_name = message.from_user.id, message.chat.title, message.from_user.first_name - logging.info("!BAN!" + LOG_COMM % (title, from_user_id, from_user_name, message.video.file_name)) + logging.info("!BAN CAPTION!" + LOG_COMM % (title, from_user_id, from_user_name, message.video.file_name)) return True return False