Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering by file type #120

Closed
aahnik opened this issue May 5, 2021 · 11 comments · Fixed by #121
Closed

Filtering by file type #120

aahnik opened this issue May 5, 2021 · 11 comments · Fixed by #121
Assignees
Labels
enhancement New feature or request todo

Comments

@aahnik
Copy link
Owner

aahnik commented May 5, 2021

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

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

@aahnik aahnik added enhancement New feature or request todo labels May 5, 2021
@aahnik aahnik self-assigned this May 5, 2021
@aahnik
Copy link
Owner Author

aahnik commented May 5, 2021

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
Copy link

And for text only??

@aahnik
Copy link
Owner Author

aahnik commented May 5, 2021

And for text only??

another valid type is nofile

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

@aahnik
Copy link
Owner Author

aahnik commented May 5, 2021

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
Copy link

tissole commented May 5, 2021

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
Copy link
Owner Author

aahnik commented May 5, 2021

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

I will add more details in the wiki soon.

@tissole
Copy link

tissole commented May 5, 2021

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

@ghost
Copy link

ghost commented May 6, 2021

wow!!! thank you:)

@ankit-sinha-18
Copy link

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
Copy link
Owner Author

aahnik commented May 6, 2021

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
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request todo
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants