tvdstaaij / telegram-history-dump

Backup Telegram chat logs using telegram-cli
Other
666 stars 84 forks source link

Exclude bots #43

Open cheeplusplus opened 8 years ago

cheeplusplus commented 8 years ago

It would be nice to have an option to exclude backing up bots, I have one that sends me a bunch of notifications daily and none of it is anything I need backed up. Alternatively, selectively excluding users similar to #40.

tvdstaaij commented 8 years ago

This is a good suggestion. I checked for ways to detect whether a user is a bot to see how this could be implemented. Unfortunately there isn't something like a bot: true/false field in the dialog objects, and while there is technically a flag for it defined by Telegram, this flag is not actually set by telegram-cli for any of the bots in my dialog list. So unless I'm overlooking something the best I could do is check for usernames suffixed with bot. This would exclude official bots not subject to the username restriction however (e.g. gif).

I'll probably go with just user exclusion, however you can easily hack the solution I mentioned above in by adding an additional condition here, for example (untested):

return false if dialog_type == 'user' && dialog['username'].downcase.end_with?("bot")