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.34k stars 797 forks source link

Case insensitive text filtering #93

Closed RebbePod closed 3 years ago

RebbePod commented 3 years ago

I just want to start off saying: thank you very much @aahnik everything is working perfectly!

Just a nice to have feature would be to have the whitelist and blacklist filters, have an optional match-case / match whole word option.

aahnik commented 3 years ago

that's a good idea. I will try to implement it soon!

ehs4nm commented 3 years ago

i want to add something here: words start with characters like '@' or '#' can't be filtered.

aahnik commented 3 years ago

i want to add something here: words start with characters like '@' or '#' can't be filtered.

is this a feature request ? or you mean this happens ?

by the way, this feature is coming in the next release!

aahnik commented 3 years ago

hi @ehs4nm and @RebbePod

After v0.1.29, by default text filtering will be case insensitive.

If you need case-sensitive text filtering, you can set it to true.

see example configuration

plugins:
  filter:
    text:
      case_sensitive: true # default is false if you don't write this line
      whitelist: ["this word"]
      blacklist: ["hello"]
ehs4nm commented 3 years ago

Thanks ahhnik. :)

ehs4nm commented 3 years ago

i want to add something here: words start with characters like '@' or '#' can't be filtered.

is this a feature request ? or you mean this happens ?

by the way, this feature is coming in the next release!

Yes. when someone wants to omit "@someid" the program run in to error.

RebbePod commented 3 years ago

Thank you, I just want to note that the default previously was true, so if updating something to note.

I also would like to suggest this feature request remains open, being that the second half of the suggestion isn't yet implemented. That is the match whole word option.

RebbePod commented 3 years ago

Also an another note, it may be a good idea to have the case sensitive option be separated for the blacklist and whitelist, not necessary for me, but a nice to have.

aahnik commented 3 years ago

what do you mean by match whole words ? @RebbePod

RebbePod commented 3 years ago

If I'm looking for "good" for example, if it matches only whole words the following would match: "Good job!" While this won't: "Goodness gracious"

aahnik commented 3 years ago

If I'm looking for "good" for example, if it matches only whole words the following would match: "Good job!" While this won't: "Goodness gracious"

issue #136 will fix it

RebbePod commented 3 years ago

Regex would would fix it, but lots of people don't know regex, I think it would be great to have as a separate basic option, and for advanced functions regex can be used.

aahnik commented 3 years ago

Yes. when someone wants to omit "@someid" the program run in to error.

@ehs4nm there is no problem. with the latest version of tgcf, I tested

read https://github.com/aahnik/tgcf/issues/138#issuecomment-859690914