Answer the question
In order to leave comments, you need to log in
A simple telegram bot. Error with pytelegrambotapi, don't understand what is the problem?
import telebot
import config
from telebot import types
bot = telebot.TeleBot(config.TOKEN)
@bot.message_handler(commands=['start'])
def lalala(message):
bot.send_message(message.chat.id, "привет".format(message.from_user, bot.get_me()),
parse_mode='html', reply_markup=markup)
# keyboard
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
item1 = types.KeyboardButton("от ppp")
item2 = types.KeyboardButton("от ooo")
markup.add(item1, item2)
@bot.message_handler(content_types=['text'])
def lalala(message):
if message.chat.type == 'private':
if message.text == 'от ppp':
bot.send_message(message.chat.id, 'Отлично! Ты подписан на уведомления от ppp')
elif message.text == 'от ooo':
bot.send_message(message.chat.id, 'Отлично! Ты подписан на уведомления от ooo')
else:
bot.send_message(message.chat.id, 'Я не знаю что ответить ')
# RUN
bot.polling(none_stop=True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question