上传文件至 /
This commit is contained in:
parent
a7c4686f66
commit
ec3962306e
26
connect.py
26
connect.py
|
@ -14,6 +14,7 @@ from mcstatus import JavaServer
|
|||
|
||||
# 功能包引用处
|
||||
from module import hitokoto
|
||||
|
||||
# 功能包结束引用
|
||||
|
||||
def get_config() -> Tuple[str, str, int]:
|
||||
|
@ -218,14 +219,25 @@ async def add_message(data: Dict[str, Any]):
|
|||
message = Message(content=f"此服务器当前在线玩家有 {players}",room_id=data['roomId'])
|
||||
|
||||
await sio.emit('sendMessage', message.to_json())
|
||||
|
||||
elif content == f'!!hitokoto {ctypet}':
|
||||
hitokoto.hitokoto(ctypet)
|
||||
result_code, result_data = hitokoto.hitokoto()
|
||||
|
||||
elif content.startswith("!!hitokoto"):
|
||||
|
||||
ctypet = content[len("!!hitokoto "):]
|
||||
if content == "!!hitokoto":
|
||||
result_code, result_data = hitokoto.hitokoto("没有")
|
||||
else:
|
||||
result_code, result_data = hitokoto.hitokoto(ctypet)
|
||||
|
||||
if result_code == 3:
|
||||
message= Message(content=f"输入参数无效,将随机选取一言句子类型",room_id=data['roomId'])
|
||||
if result_code == 0:
|
||||
message = Message(f"Hitokoto: {result_data['hitokoto']}")
|
||||
message = Message(content=f"参数不对哦!",room_id=data['roomId'])
|
||||
elif result_code == 2:
|
||||
message = Message(content=f"发生了不可描述的错误X_X", room_id=data['roomId'])
|
||||
elif result_code == 0:
|
||||
message = Message(content=f"Hitokoto: {result_data['hitokoto']}", room_id=data['roomId'])
|
||||
else:
|
||||
message = Message(content=f"但你看到这条消息就代表有bug出炉", room_id=data['roomId'])
|
||||
|
||||
await sio.emit('sendMessage', message.to_json())
|
||||
|
||||
elif data.get('message').get('content').startswith('=='):
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user