Skip to content

Instantly share code, notes, and snippets.

@xjxckk
Last active December 16, 2021 12:18
Show Gist options
  • Save xjxckk/372c3ecd75f52785009ff0e59c8d6b08 to your computer and use it in GitHub Desktop.
Save xjxckk/372c3ecd75f52785009ff0e59c8d6b08 to your computer and use it in GitHub Desktop.
Telegram progress updater (Python)
import telegram
from time import sleep
bot = telegram.Bot(token='token')
msg = bot.send_message(chat_id='Channel ID', text='1/10')
# msg = bot.edit_message_text(text='2/10', chat_id='Channel ID', message_id=1) # To edit an old message
# print(msg.message_id)
for x in range(10):
progress = f'{x}/10'
print(progress)
msg.edit_text(progress)
sleep(3) # 3 second timeout needed to avoid Telegram flood control
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment