Skip to content

Commit

Permalink
fix(otterbot): 修复回复+图片
Browse files Browse the repository at this point in the history
  • Loading branch information
LambdaYH committed Aug 2, 2024
1 parent 7e1a11d commit 95e3664
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions migang/plugins/ffxiv/ffxiv_otterbot/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from pydantic import BaseModel
from nonebot.adapters import Bot, Event
from websockets import WebSocketClientProtocol
from nonebot.adapters.onebot.v11 import MessageSegment
from nonebot.adapters.onebot.v11 import MessageSegment, Message
from websockets.exceptions import ConnectionClosedOK, ConnectionClosedError

_HEARTBEAT_INTERVAL = 3
Expand Down Expand Up @@ -39,10 +39,11 @@ def _proccess_api(action: str, data: dict[str, Any]):
if action == "get_group_member_list":
data["params"]["group_id"] = str(data["params"]["group_id"])
message: str = data["params"].get("message")
if message and (match := re.search(_reply_id_pattern, message)):
data["params"]["message"] = MessageSegment.reply(
match.group(1)
) + message.replace(match.group(0), "")
if message:
if match := re.search(_reply_id_pattern, message):
data["params"]["message"] = MessageSegment.reply(
match.group(1)
) + Message(message.replace(match.group(0), "").strip())


class WebSocketConn:
Expand Down

0 comments on commit 95e3664

Please sign in to comment.