1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Register_XXX_Handler

This commit is contained in:
_run 2021-09-22 22:46:19 +05:00
parent cd92d95f91
commit 716323e56a
3 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,5 @@
import telebot
api_token = ''
bot = telebot.TeleBot(api_token)

View File

@ -0,0 +1,9 @@
# All handlers can be written in this file
from config import bot
def start_executor(message):
bot.send_message(message.chat.id, 'Hello!')
# Write more handlers here if you wish. You don't need a decorator
# Just create function and register in main file.

View File

@ -0,0 +1,19 @@
import telebot
from telebot import custom_filters
import config
bot = telebot.TeleBot(config.api_token)
import handlers
bot.register_message_handler(handlers.start_executor, commands=['start']) # Start command executor
# 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..
bot.polling()