pyTelegramBotAPI/examples/register_handler.py

22 lines
616 B
Python
Raw Permalink Normal View History

2021-09-22 20:46:19 +03:00
import telebot
2021-09-25 15:15:33 +03:00
api_token = 'token'
2021-09-22 20:46:19 +03:00
2021-09-25 15:12:32 +03:00
bot = telebot.TeleBot(api_token)
def start_executor(message):
bot.send_message(message.chat.id, 'Hello!')
bot.register_message_handler(start_executor, commands=['start']) # Start command executor
2021-09-22 20:46:19 +03:00
# See also
# bot.register_callback_query_handler(*args, **kwargs)
# bot.register_channel_post_handler(*args, **kwargs)
# bot.register_chat_member_handler(*args, **kwargs)
# bot.register_inline_handler(*args, **kwargs)
# bot.register_my_chat_member_handler(*args, **kwargs)
# bot.register_edited_message_handler(*args, **kwargs)
# And other functions..
2021-09-28 19:17:09 +03:00
bot.infinity_polling()