python-telegram-bot delete message code example
Example: python telegram bot delete message
# install bot library (in the bash/ commend)
# $ pip install pyTelegramBotAPI
import telebot #import the library
TOKEN = '<token_string>'
tb = telebot.TeleBot(TOKEN) #create a new Telegram Bot object
# Upon calling this function, TeleBot starts polling the Telegram servers for new messages.
# - none_stop: True/False (default False) - Don't stop polling when receiving an error from the Telegram servers
# - interval: True/False (default False) - The interval between polling requests
# Note: Editing this parameter harms the bot's response time
# - timeout: integer (default 20) - Timeout in seconds for long polling.
tb.polling(none_stop=False, interval=0, timeout=20)
tb.delete_message(chat_id, message_id, timeout=None)