Answer the question
In order to leave comments, you need to log in
How to fix 409 Conflict error in Telegram bot?
Why can't I use the bot variable in another file? Error, supposedly the bot is already running (one instance of the bot is running). Please help.
main.py
@bot.callback_query_handler(func=lambda msg: True)
def callback_Func(callback_query):
message = callback_query.message
text = callback_query.data
user.send_mess(f'Оплатите заказ в течении 30 минут, иначе заказ аннулируется',
buttons.ls_keybs_orders(message.chat.id)[0], message.chat.id, message.message_id)
def send_mess(mess, st_order, chat_id, mess_id, bot):
print(st_order)
bot.edit_message_text(chat_id = chat_id, message_id = mess_id, text = f'*Ваш заказ № {conn_DB.id_Zakaz()}'\
f' СФОРМИРОВАН!* {mess}.\n Спасибо за заказ, *ожидайте звонка* \U0001f4de.',
parse_mode = "Markdown", reply_markup = buttons.send_keyb_order(st_order))
Answer the question
In order to leave comments, you need to log in
Starting the bot with __main__ helped
if __name__ == '__main__': # чтобы код выполнялся только при запуске в виде сценария, а не при импорте модуля
try:
bot.polling(none_stop=True) # запуск бота
except Exception as e:
print(e) # или import traceback; traceback.print_exc() для печати полной инфы
time.sleep(15)
Perhaps you have a webhook set up and you are trying to do getUpdates
https://stackoverflow.com/questions/36120529/teleg...
Or getUpdates comes from multiple threads/processes
Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question