'이것저것'에 해당되는 글 10건
- 2022.09.03 telepot KeyError: No suggested keys 2
두 파일 모두 #1을 #2 처럼 수정해서 실행후 종료, 두 파일 모두 원래대로 수정 후 재실행
### vi /usr/local/lib/python3.9/dist-packages/telepot/loop.py
#1
def _extract_message1(update):
key = _find_first_key(update, ['update_id',
'message',
'edited_message',
'channel_post',
'edited_channel_post',
'callback_query',
'inline_query',
'chosen_inline_result',
'shipping_query',
'pre_checkout_query'])
return key, update[key]
#2
def _extract_message(update):
key = _find_first_key(update, ['message',
'edited_message',
'channel_post',
'edited_channel_post',
'callback_query',
'inline_query',
'chosen_inline_result',
'shipping_query',
'pre_checkout_query'])
if key != 'update_id':
return key, update[key]
if 'message' in update.keys():
return 'message', update['message']
if 'my_chat_member' in update.keys():
return 'message', {'message_id': update['update_id'],
'from': update['my_chat_member']['from'],
'chat': update['my_chat_member']['chat'],
'date': update['my_chat_member']['date'],
'text': f"It's update_id {update['update_id']}"
}
raise Exception('The hotfix for update_id bug needs to upgrade')
### vi /usr/local/lib/python3.9/dist-packages/telepot/__init__.py
#1
def relay_to_collector1(update):
key = _find_first_key(update, ['update_id',
'message',
'edited_message',
'channel_post',
'edited_channel_post',
'callback_query',
'inline_query',
'chosen_inline_result',
'shipping_query',
'pre_checkout_query'])
collect_queue.put(update[key])
return update['update_id']
#2
def relay_to_collector(update):
key = _find_first_key(update, ['message',
'edited_message',
'channel_post',
'edited_channel_post',
'callback_query',
'inline_query',
'chosen_inline_result',
'shipping_query',
'pre_checkout_query'])
collect_queue.put(update[key])
|
|