fix(qq-botpy): 群内单query多回复时msg_seq重复问题

This commit is contained in:
Junyan Qin 2024-03-30 02:58:37 +00:00
parent 63307633c2
commit cac5a5adff

View File

@ -368,11 +368,15 @@ class OfficialAdapter(adapter_model.MessageSourceAdapter):
member_openid_mapping: OpenIDMapping[str, int] = None member_openid_mapping: OpenIDMapping[str, int] = None
group_openid_mapping: OpenIDMapping[str, int] = None group_openid_mapping: OpenIDMapping[str, int] = None
group_msg_seq = None
def __init__(self, cfg: dict, ap: app.Application): def __init__(self, cfg: dict, ap: app.Application):
"""初始化适配器""" """初始化适配器"""
self.cfg = cfg self.cfg = cfg
self.ap = ap self.ap = ap
self.group_msg_seq = 1
switchs = {} switchs = {}
for intent in cfg["intents"]: for intent in cfg["intents"]:
@ -419,8 +423,6 @@ class OfficialAdapter(adapter_model.MessageSourceAdapter):
message_list = self.message_converter.yiri2target(message) message_list = self.message_converter.yiri2target(message)
msg_seq = 1
for msg in message_list: for msg in message_list:
args = {} args = {}
@ -462,8 +464,8 @@ class OfficialAdapter(adapter_model.MessageSourceAdapter):
args["msg_id"] = cached_message_ids[ args["msg_id"] = cached_message_ids[
str(message_source.message_chain.message_id) str(message_source.message_chain.message_id)
] ]
args["msg_seq"] = msg_seq args["msg_seq"] = self.group_msg_seq
msg_seq += 1 self.group_msg_seq += 1
await self.bot.api.post_group_message(**args) await self.bot.api.post_group_message(**args)
async def is_muted(self, group_id: int) -> bool: async def is_muted(self, group_id: int) -> bool: