From 6a3a31ab18e847ce18a9f3450f61712e95a1b9b5 Mon Sep 17 00:00:00 2001 From: SharwOrange Date: Sat, 30 Dec 2023 19:55:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E9=83=A8=E5=88=86=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=9B=9E=E5=A4=8D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- connect.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/connect.py b/connect.py index 13eb0bf..b84fa30 100644 --- a/connect.py +++ b/connect.py @@ -191,6 +191,7 @@ async def add_message(data: Dict[str, Any]): sender_id = data['message']['senderId'] content = data['message']['content'] room_id = data['roomId'] + reply = ReplyMessage(id=data['message']['_id']) if not is_self: if data.get('message').get('content') == '/bot': @@ -208,7 +209,7 @@ async def add_message(data: Dict[str, Any]): # else: # message = Message(content=f"此服务器空无一人",room_id=data['roomId']) - message = Message(content=f"此服务器有 {status.players.online} 个玩家在线",room_id=data['roomId']) + message = Message(content=f"此服务器有 {status.players.online} 个玩家在线",reply_to=reply,room_id=data['roomId']) await sio.emit('sendMessage', message.to_json()) @@ -216,7 +217,7 @@ async def add_message(data: Dict[str, Any]): server = JavaServer.lookup("192.168.1.6:25565") query = server.query() players = query.players.names - message = Message(content=f"此服务器当前在线玩家有 {players}",room_id=data['roomId']) + message = Message(content=f"此服务器当前在线玩家有 {players}",reply_to=reply,room_id=data['roomId']) await sio.emit('sendMessage', message.to_json()) @@ -229,15 +230,15 @@ async def add_message(data: Dict[str, Any]): result_code, result_data, result_type= hitokoto.hitokoto(ctypet) if result_code == 3: - message = Message(content=f"参数不对哦!你可以输入!!hitokoto help查看帮助",room_id=data['roomId']) + message = Message(content=f"参数不对哦!你可以输入!!hitokoto help查看帮助",reply_to=reply,room_id=data['roomId']) elif result_code == 2: - message = Message(content=f"发生了不可描述的错误X_X,但可以肯定的是模块炸了(", room_id=data['roomId']) + message = Message(content=f"发生了不可描述的错误X_X,但可以肯定的是模块炸了(",reply_to=reply,room_id=data['roomId']) elif result_code == 1: - message = Message(content=f"(参数)句子类型如下\na 动画\nb 漫画\nc 游戏\nd 文学\ne 原创\nf 来自网络\ng 其他\nh 影视\ni 诗词\nj 网易云\nk 哲学\nl 抖机灵", room_id=data['roomId']) + message = Message(content=f"(参数)句子类型如下\na 动画\nb 漫画\nc 游戏\nd 文学\ne 原创\nf 来自网络\ng 其他\nh 影视\ni 诗词\nj 网易云\nk 哲学\nl 抖机灵",reply_to=reply,room_id=data['roomId']) elif result_code == 0: - message = Message(content=f"“{result_data['hitokoto']}”\n来源:{result_data['from']}\n类型:{result_type}", room_id=data['roomId']) + message = Message(content=f"“{result_data['hitokoto']}”\n来源:{result_data['from']}\n类型:{result_type}",reply_to=reply,room_id=data['roomId']) else: - message = Message(content=f"你看到这条消息就代表有bug出炉,但肯定不是模块炸了(", room_id=data['roomId']) + message = Message(content=f"你看到这条消息就代表有bug出炉,但肯定不是模块炸了(",reply_to=reply,room_id=data['roomId']) await sio.emit('sendMessage', message.to_json())