From d1b27d3825e2b326dcfb7e1cfb182d378a49c19f Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Mon, 11 Dec 2023 18:17:41 +0800 Subject: [PATCH] Update connect.py: Fix requireAuth function and modify jrrp logic --- connect.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/connect.py b/connect.py index 85925c1d..07333404 100644 --- a/connect.py +++ b/connect.py @@ -2,7 +2,6 @@ import time import random import asyncio import traceback -import multiprocessing from typing import Dict, List, Tuple, Any, Optional, Union, Literal @@ -67,7 +66,7 @@ class Message(Options): } -sio = socketio.AsyncClient() +sio: socketio.AsyncClient = socketio.AsyncClient() @sio.on('connect') @@ -87,6 +86,10 @@ async def require_auth(salt: str, versions: Dict[str, str]): await sio.emit('auth', signature.signature) print(f"{Fore.BLUE}send auth emit{Style.RESET_ALL}") +# @sio.on('requireAuth') +# def require_auth(*data: Dict[str, Any]): +# print(f"{Fore.BLUE}requireAuth: {data}{Style.RESET_ALL}") + @sio.on('auth') def auth(data: Dict[str, Any]): @@ -223,8 +226,8 @@ async def add_message(data: Dict[str, Any]): await asyncio.sleep(random.random() * 2) await sio.emit('sendMessage', message.to_json()) - elif data['message']['content'] == 'jrrp': - randomer = random.Random(f'{sender_id}-{data["message"]["date"]}-jrrp') + elif data['message']['content'] == '!!jrrp': + randomer = random.Random(f'{sender_id}-{data["message"]["date"]}-jrrp-v2') result = randomer.randint(0, 50) + randomer.randint(0, 50) print(f'{sender_name} 今日人品值为 {result}') reply = ReplyMessage(id=data['message']['_id'])