添加更多QQ监听
This commit is contained in:
parent
2f168f1287
commit
6cc45eff8c
23
server.py
23
server.py
@ -1,5 +1,5 @@
|
|||||||
import tomllib
|
import tomllib
|
||||||
from typing import Dict
|
from typing import Dict, Any
|
||||||
|
|
||||||
from nacl.signing import SigningKey
|
from nacl.signing import SigningKey
|
||||||
from sanic import Sanic, Request
|
from sanic import Sanic, Request
|
||||||
@ -85,6 +85,27 @@ def start_sio_listener():
|
|||||||
await app.ctx.sio.emit('auth', signature.signature)
|
await app.ctx.sio.emit('auth', signature.signature)
|
||||||
logger.info(f"{Colors.BLUE}send auth emit{Colors.END}")
|
logger.info(f"{Colors.BLUE}send auth emit{Colors.END}")
|
||||||
|
|
||||||
|
@app.ctx.sio.on('auth')
|
||||||
|
async def auth(data: Dict[str, Any]):
|
||||||
|
logger.info(f"auth: {data}")
|
||||||
|
|
||||||
|
@app.ctx.sio.on('authFailed')
|
||||||
|
async def auth_failed():
|
||||||
|
logger.warn(f"authFailed")
|
||||||
|
await app.ctx.sio.disconnect()
|
||||||
|
|
||||||
|
@app.ctx.sio.on('authSucceed')
|
||||||
|
def auth_succeed():
|
||||||
|
logger.info(f"authSucceed")
|
||||||
|
|
||||||
|
@app.ctx.sio.on('connect_error')
|
||||||
|
def connect_error(*args, **kwargs):
|
||||||
|
logger.warn(f"连接错误 {args}, {kwargs}")
|
||||||
|
|
||||||
|
@app.ctx.sio.on('updateRoom')
|
||||||
|
def update_room(data: Dict[str, Any]):
|
||||||
|
logger.info(f"update_room: {data}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(host='0.0.0.0', port=80, dev=True)
|
app.run(host='0.0.0.0', port=80, dev=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user