- TeleBot: "AttributeError occurred, args=("'unicode' object has no attribute 'id'",)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/telebot/util.py", line 60, in run
task(*args, **kwargs)
File "main.py", line 12, in menu
if message.text.id == "💰 Кошелёк ETH":
AttributeError: 'unicode' object has no attribute 'id'
"
2020-07-11 16:35:18,699 (util.py:66 PollingThread) ERROR - TeleBot: "ApiException occurred, args=('A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body:\n[{"ok":false,"error_code":409,"description":"Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}]',)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/telebot/util.py", line 60, in run
task(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/telebot/__init__.py", line 279, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/telebot/__init__.py", line 249, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates)
File "/usr/local/lib/python2.7/dist-packages/telebot/apihelper.py", line 194, in get_updates
return _make_request(token, method_url, params=payload)
File "/usr/local/lib/python2.7/dist-packages/telebot/apihelper.py", line 60, in _make_request
return _check_result(method_name, result)['result']
File "/usr/local/lib/python2.7/dist-packages/telebot/apihelper.py", line 79, in _check_result
raise ApiException(msg, method_name, result)
ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 409 Conflict. Response body:
[{"ok":false,"error_code":409,"description":"Conflict: terminated by other getUpdates request; make sure that only one bot instance is running"}]
"
код:
# - *- coding: utf- 8 - *-
import telebot
from telebot import types
Token=''
bot = telebot.TeleBot(Token)
@bot.message_handler(commands = ['start'])
def send_welcome(message):
bot.send_message(message.chat.id, "text", reply_markup = menu_keyboard)
bot.register_next_step_handler(menu, proccesing_cities)
@bot.message_handler(content_types = ['text'])
def menu(message):
if message.text == "💰 кнопка1":
bot.send_message(message.from_user.id, "text")
menu_keyboard = types.ReplyKeyboardMarkup(resize_keyboard = True, row_width = 2)
menu_keyboard.add(types.KeyboardButton("💰 кнопка1"), types.KeyboardButton("🎲 кнопка2"), types.KeyboardButton("🚀 кнопка3"), types.KeyboardButton("🤝 кнопка4"))
bot.infinity_polling(True)
У тебя в ошибке и в "коде" 12 строка разная
Обсуждают сегодня