Skip to content

Instantly share code, notes, and snippets.

@RedL0tus RedL0tus/mark_read.py
Last active Apr 10, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.