Нужна помощь с обработкой команд в библиотеке PyTelegramBotApi
В телеграм ботах ведь есть команды /command и !command. И если /command обрабатывается следующим образом:
@bot.message_handler(commands=['command'])
def some_func(message):
Действие
То как обрабатывается !command?
Ответы (1 шт):
Автор решения: Zhymabek Roman
→ Ссылка
Вот рабочии код:
import telebot
import logging
from telebot import types
API_TOKEN = 'BOT TOKEN HERE'
bot = telebot.TeleBot(API_TOKEN)
logger = telebot.logger
telebot.logger.setLevel(logging.DEBUG)
@bot.message_handler(func=lambda message: message.text.lower() in ["/command", "!command"])
def send_welcome(message):
msg = bot.reply_to(message, "Привет!")
if __name__ == '__main__':
bot.infinity_polling()
Удачи!