Answer the question
In order to leave comments, you need to log in
Error in PyCharm, does not start the bot, what should I do?
Here is the code:
@bot.message_handler(commands=['start'])
def start_message(message):
bot.send_message(message.chat.id, 'Привет, я бот', reply_markup=keyboard())
@bot.message_handler(content_types=['text'])
def send_text(message):
if message.text.lower() == 'Купить':
bot.send_message(message.chat.id, '''Товар 1
Товар 2
Товар 3''')
elif message.text.lower() == 'Рулетка':
bot.send_message(message.chat.id, 'Ты выиграл приз!')
def keyboard(): #клавиатура купить/рулетка
markup = types.ReplyKeyboardMarkup(one_time_keyboard=True, resize_keyboard=True)
btn1 = types.KeyboardButton('Рулетка')
btn2 = types.KeyboardButton('Купить')
markup.add(btn1, btn2)
bot.polling()
Answer the question
In order to leave comments, you need to log in
bot.message_handler(content_types=['text'])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question