python telegram bot command code example

Example 1: telegram bot python

import telepot
from telepot.loop import MessageLoop

def handle(msg):
    content_type, chat_type, chat_id = telepot.glance(msg)
    print(content_type, chat_type, chat_id)

bot = telepot.Bot("INSERT TOKEN HERE")
bot.message_loop(handle)

Example 2: python telegram bot command list

#Steps to add Command list
A. Go to @BotFather on Telegram
B. Send him /setcommands
C. send him @your_bot
D. Make Command list use this format
command1 - Description
command2 - Another description