aahnik / tgcf

The ultimate tool to automate custom telegram message forwarding. Live-syncer, Auto-poster, backup-bot, cloner, chat-forwarder, duplicator, ... Call it whatever you like! tgcf can fulfill your custom needs.
https://github.com/aahnik/tgcf/wiki
MIT License
1.38k stars 811 forks source link

Filtering by file type #120

Closed aahnik closed 3 years ago

aahnik commented 3 years ago

allow only certain types of files, or ban certain types of files.

this is requested by multiple people #116 , #61 , #6

aahnik commented 3 years ago

This feature can be used by using the filter plugin and specifying the files you want to filter

example inside your config file:

plugins:
  filter:
    files:
      whitelist: [document]

you can use a blacklist instead of a whitelist also

     blacklist: [video]

The valid file types are :


    audio
    gif
    video
    video_note
    sticker
    contact
    photo
    document
    nofile

if a message has no files in it, then the type is nofile , you may add nofile to whitelist or blacklist, just like the other types.

ankit-sinha-18 commented 3 years ago

And for text only??

aahnik commented 3 years ago

And for text only??

another valid type is nofile

i added the feature, then I saw your comment !😅

aahnik commented 3 years ago

hi @ankit-sinha-18 @warmkenley @ThatDevCoder

make sure to use the latest tgcf 0.1.27 or above, to test this feature!

and please help me by sharing tgcf on social media.

tissole commented 3 years ago

Thank you for this update, I will test the new feature and give feedback. But I have a few questions. How about the archives? They are in the document category? Non-streamable videos or videos sent as files, belong to video type? Does the document category include pdf, epub, mobi?

aahnik commented 3 years ago

Hi @tissole, please experiment, and answer your own questions.

I will add more details in the wiki soon.

tissole commented 3 years ago

OK. I will blacklist (gif, sticker, video-note, contact, no file). Curious about the results.

ghost commented 3 years ago

wow!!! thank you:)

ankit-sinha-18 commented 3 years ago

hi @ankit-sinha-18 @warmkenley @ThatDevCoder

make sure to use the latest tgcf 0.1.27 or above, to test this feature!

and please help me by sharing tgcf on social media.

Hi @aahnik , I have tested new version of tgcf 0.1.28.

Review For tgcf 0.1.28.

I have checked all filters ( audio ,gif, video, video, note, sticker, contact, photo, document, nofile) are working perfectly.

whitelist and blacklist for users , text and file are also working good.

In past mode, delay is also working for different values.

In live mode, delete_sync is working. But delete_sync won't work for previous messages if bot will restart. And, It will also not work, if admin will delete multiple messages in source at once, then only the first message will get deleted in dest , not all.

aahnik commented 3 years ago

thank you @ankit-sinha-18 for your review. this is very helpful.

if admin will delete multiple messages in source at once, then only the first message will get deleted in dest , not all.

this is a critical piece of information, and I did not know this. thanks for your help!

i have create a new issue for this #128

mujahidazamcsm commented 3 years ago

Hi ,

If a message contains both image and text.. Is this possible to block the image only and send the text to the destination channel?