update rpc response format
This commit is contained in:
parent
60c6448f72
commit
fed68c0dfb
8
main.py
8
main.py
@ -358,10 +358,14 @@ async def send_callback(cq: CallbackQuery):
|
|||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"id": 0,
|
"id": 0,
|
||||||
})
|
})
|
||||||
|
logging.info(r.text)
|
||||||
resp = r.json()
|
resp = r.json()
|
||||||
if resp.get('result') == 'duplicate':
|
result = resp.get('result')
|
||||||
|
if not result:
|
||||||
|
raise Exception(f'No result in response: {resp}')
|
||||||
|
if resp.get('status') == 'duplicate':
|
||||||
await cq.answer('Duplicate')
|
await cq.answer('Duplicate')
|
||||||
elif resp.get('result'):
|
elif resp.get('status') == 'ok':
|
||||||
await cq.answer('Sent')
|
await cq.answer('Sent')
|
||||||
else:
|
else:
|
||||||
raise Exception(resp)
|
raise Exception(resp)
|
||||||
|
Loading…
Reference in New Issue
Block a user