Skip to content

Instantly share code, notes, and snippets.

@RedL0tus
Last active April 10, 2018 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RedL0tus/c994a2e2a340251cbed9f9ccc98a6a86 to your computer and use it in GitHub Desktop.
Save RedL0tus/c994a2e2a340251cbed9f9ccc98a6a86 to your computer and use it in GitHub Desktop.
Mark recent dialogs as read in telegram by using telegram-cli and pytg
#!/usr/bin/env python3
#-*- encoding: utf-8 -*-
# please install pytg and telegram-cli before running this script
# pytg: https://github.com/luckydonald/pytg
# telegram-cli: https://github.com/vysheng/tg
from pytg import Telegram
def main():
tg = Telegram(
telegram="/path/to/tg-cli/bin/telegram-cli",
pubkey_file="/path/to/tg-cli/tg-server.pub")
sender = tg.sender
count = 0
for i in sender.dialog_list():
count += 1
print(">>> Processing " + i.print_name)
sender.mark_read(str(i.print_name))
print(">>> Total " + str(count) + " dialogs processed.")
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment