Answer the question
In order to leave comments, you need to log in
I can't find an error in the code?
I want to write a bot that will change course every 5 seconds. This is the part of the code that doesn't work. There is a spelling mistake in this part.
bot.edit_message_text(chat_id = message.chat.id, message_id = msg.message_id, text = 'Крс биткоина - {nut}')
When I remove the variable, everything works, but it doesn't work with it. import telebot
import config
bot = telebot.TeleBot(config.TOKEN)
@bot.message_handler(commands=['start'])
def send_welcome(message):
nut = 1
nut2 = 2
msg = bot.send_message(message.chat.id, f'Крс биткоина - {nut}')
bot.edit_message_text(chat_id = message.chat.id, message_id = msg.message_id, text = 'Крс биткоина - {nut}')
bot.polling()
Answer the question
In order to leave comments, you need to log in
I ran this code, everything works. The message changes, there are no errors.
import telebot
bot = telebot.TeleBot("TOKEN")
@bot.message_handler(commands=['start'])
def send_welcome(message):
msg = bot.send_message(message.chat.id, 'Крс биткоина - 10')
bot.edit_message_text(chat_id = message.chat.id, message_id = msg.message_id, text = 'Крс биткоина - 20')
bot.polling()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question