Answer the question
In order to leave comments, you need to log in
A simple telegram bot with buttons does not work What should I do? worked with the same code?
The telegram bot doesn’t work, the window closes right away, even it doesn’t write anything to the console, it only closes in the python file and you can see the error text for 0.5 seconds here is the code
import telebot
bot = telebot.TeleBot('токен убрал')
keyboard1 = telebot.types.ReplyKeyboardMarkup()
keyboard1.row('Привет', 'Пока')
@bot.message_handler(commands=['start'])
def start_message(message):
bot.send_message(message.chat.id, 'Привет, ты написал мне /start', reply_markup=keyboard1)
@bot.message_handler(content_types=['text'])
def send_text(message):
if message.text.lower() == 'привет':
bot.send_message(message.chat.id, 'Привет,морген ')
elif message.text.lower() == 'пока':
bot.send_message(message.chat.id, 'Прощай, создатель')
elif message.text.lower() == 'я тебя люблю':
bot.send_sticker(message.chat.id, '')
@bot.message_handler(content_types=['sticker'])
def sticker_id(message):
print(message)
bot.polling()
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