From 5dbd3aa87ab8176d07cb785e00ab306706fea2b4 Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Tue, 9 Jan 2024 19:19:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E8=80=83=E8=AF=95?= =?UTF-8?q?=E5=91=A8100=E4=BA=BA=E5=93=81=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/connect.py b/connect.py index d4bf782..ba9fe2d 100644 --- a/connect.py +++ b/connect.py @@ -277,12 +277,21 @@ 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-v2') - result = randomer.randint(0, 50) + randomer.randint(0, 50) - print(f'{sender_name} 今日人品值为 {result}') - message = Message(content=f'{sender_name} 今日人品值为 {result}', - reply_to=reply, - room_id=room_id) + bool examSet = false + if examSet == true: + print('examSet参数被设定,替换人品值') + message = Message(content=f'{sender_name} 今日人品值为 100\n为了让你安心备考,加油考试,今天你的人品值是100!', + reply_to=reply, + room_id=room_id) + await asyncio.sleep(0.5) + await sio.emit('sendMessage', message.to_json()) + else: + 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}') + message = Message(content=f'{sender_name} 今日人品值为 {result}', + reply_to=reply, + room_id=room_id) await asyncio.sleep(0.5) await sio.emit('sendMessage', message.to_json()) # 如果只包括一个或多个 6