解决非文本消息报错
This commit is contained in:
parent
6df0e82420
commit
02b9ffec7b
@ -240,7 +240,11 @@ def start_sio_listener():
|
||||
@app.ctx.sio.on('addMessage')
|
||||
async def add_message(data: Dict[str, Any]):
|
||||
sio_decorator = cmds.cmds(app, data)
|
||||
try:
|
||||
await sio_decorator.route2cmd_and_run()
|
||||
except IndexError:
|
||||
# 处理非文本消息
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -110,8 +110,6 @@ class SioDecorator:
|
||||
self.cmds[f'/{cmd}'] = func
|
||||
|
||||
async def route2cmd_and_run(self):
|
||||
if self._cmd == '':
|
||||
return None
|
||||
func = self.cmds.get(self._cmd[0])
|
||||
if func:
|
||||
sender_id = self.data['message']['senderId']
|
||||
|
Loading…
Reference in New Issue
Block a user