Я попробовал установить идентификатор как переменную:
Код: Выделить всё
import telepot
from telepot.namedTuple import InlineKeyboardMarkup, InlineKeyboardButton
messageEditID = bot.sendMessage(, "Test", reply_markup=InlineKeyboardMarkup(inline_keyboard=[[InlineKeyboardButton(text="Testing", callback_data="test"]]))['message_id']
Код: Выделить всё
{"message_id":1140126,"chat":{"title":"","type":"supergroup","id":},"date":1477960655,"from":{"username":"","first_name":"","id":},"text":"Test"}
Код: Выделить всё
if msg['data'] == 'test':
bot.editMessage(messageEditID, "Did it work?")
Код: Выделить всё
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/telepot/__init__.py", line 738, in collector
callback(item)
File "testingStuff.py", line 150, in handle
bot.editMessageText(messageEditID, "Does it work?")
File "/usr/local/lib/python3.5/dist-packages/telepot/__init__.py", line 592, in editMessageText
return self._api_request('editMessageText', _rectify(p))
File "/usr/local/lib/python3.5/dist-packages/telepot/__init__.py", line 398, in _api_request
return api.request((self._token, method, params, files), **kwargs)
File "/usr/local/lib/python3.5/dist-packages/telepot/api.py", line 131, in request
return _parse(r)
File "/usr/local/lib/python3.5/dist-packages/telepot/api.py", line 126, in _parse
raise exception.TelegramError(description, error_code, data)
telepot.exception.TelegramError: ('Bad Request: Wrong inline message identifier specified', 400, {'description': 'Bad Request: Wrong inline message identifier specified', 'ok': False, 'error_code': 400})
Код: Выделить всё
if msg['data'] == 'test':
msgID = msg['message']['message_id']
bot.editMessageText(msgID, "OBOY")
Код: Выделить всё
{'chat_instance': '112564336693044113',
'data': 'test',
'from': {'first_name': 'B(', 'id': , 'username': ''},
'id': '852908411206280027',
'message': {'chat': {'id': ,
'title': 'We da bes',
'type': 'supergroup',
'username': ''},
'date': 1477961765,
'from': {'first_name': 'Testing For James',
'id': ,
'username': ''},
'message_id': 63180,
'text': 'Test'}}
Подробнее здесь: https://stackoverflow.com/questions/403 ... on-bot-api
Мобильная версия