fix a bug

This commit is contained in:
xtaodada 2022-03-09 18:56:45 +08:00
parent 19b1b2a28c
commit 0ae4cb80f8
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -26,6 +26,7 @@ from ehforwarderbot.exceptions import (
EFBMessageError,
EFBOperationNotSupported,
)
from ehforwarderbot.chat import GroupChat
from ehforwarderbot.message import MessageCommand, MessageCommands
from ehforwarderbot.status import MessageRemoval
from ehforwarderbot.types import ChatID, MessageID
@ -254,7 +255,8 @@ class GoCQHttp(BaseClient):
if not isinstance(messages[i], Message):
continue
efb_msg: Message = messages[i]
efb_msg.uid = f"{chat.uid}_{coolq_msg_id}_{i}" if i > 0 else f"{chat.uid}_{coolq_msg_id}"
efb_msg.uid = f"{chat.uid.split('_')[-1]}_{coolq_msg_id}_{i}" if i > 0 else \
f"{chat.uid.split('_')[-1]}_{coolq_msg_id}"
efb_msg.chat = chat
efb_msg.author = author
# if qq_uid != '80000000':
@ -382,18 +384,13 @@ class GoCQHttp(BaseClient):
@self.coolq_bot.on_notice("group_recall")
def handle_group_recall_msg(context):
coolq_msg_id = context["message_id"]
chat: Chat
try:
chat = self.chat_manager.build_efb_chat_as_group(context)
except:
return
if len(all_group_list) > 0 and chat.uid not in all_group_list:
chat = GroupChat(channel=self.channel, uid=f"group_{context['group_id']}")
if len(all_group_list) > 0 and int(chat.uid.split('_')[-1]) not in all_group_list:
print(f"Filter 1 group recall from {chat.uid} {chat.name}.")
return
efb_msg = Message(
chat=chat,
uid=MessageID([[f"{chat.uid}_{coolq_msg_id}"]])
uid=MessageID([[f"{chat.uid.split('_')[-1]}_{coolq_msg_id}"]])
)
coordinator.send_status(MessageRemoval(source_channel=self.channel,
destination_channel=coordinator.master,
@ -409,7 +406,7 @@ class GoCQHttp(BaseClient):
return
efb_msg = Message(
chat=chat,
uid=MessageID([[f"{chat.uid}_{coolq_msg_id}"]])
uid=MessageID([[f"{chat.uid.split('_')[-1]}_{coolq_msg_id}"]])
)
coordinator.send_status(MessageRemoval(source_channel=self.channel,
destination_channel=coordinator.master,