mirror of
http://shenjack.top:5100/shenjack/icalingua-python-bot.git
synced 2024-11-23 04:31:05 +08:00
Update connect.py: Fix requireAuth function and modify jrrp logic
This commit is contained in:
parent
ec399233cc
commit
d1b27d3825
11
connect.py
11
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'])
|
||||
|
|
Loading…
Reference in New Issue
Block a user