diff --git a/pdm.lock b/pdm.lock index 266f4b5..e9935d2 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev"] strategy = [] lock_version = "4.5.0" -content_hash = "sha256:aa439e10a0a3fad97ca595a12f677383cb63deea46cfddd6d9f2d33383aca6e4" +content_hash = "sha256:cef91ff597d9180a8b50c1cdc0e6a1541262a2c71dbfd33914aa48375b429d57" [[metadata.targets]] requires_python = ">=3.9" @@ -1239,15 +1239,15 @@ files = [ [[package]] name = "nonebot-adapter-satori" -version = "0.12.6" +version = "0.13.0" requires_python = ">=3.9" summary = "Satori Protocol Adapter for Nonebot2" dependencies = [ "nonebot2>=2.3.0", ] files = [ - {file = "nonebot_adapter_satori-0.12.6-py3-none-any.whl", hash = "sha256:b15d9a8d90e0ceb9a133d6443b505c9e3e1df65a5ae77719022a1c20b1d96f83"}, - {file = "nonebot_adapter_satori-0.12.6.tar.gz", hash = "sha256:afce9c5ded45ca302b8c42c5ad13c675ca956d00dc47dc99e0bc5acf7e62d093"}, + {file = "nonebot_adapter_satori-0.13.0-py3-none-any.whl", hash = "sha256:aa5d8fe3472958cc1b8f035d92fb53a21d88df08f3913444cf9bc80c554b9e6e"}, + {file = "nonebot_adapter_satori-0.13.0.tar.gz", hash = "sha256:124c39389612b8aeb9c58c364cf98985b2ec61a3dce847a4378d6bcf5d24559e"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 3104abf..5c00c87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,9 +55,9 @@ dev = [ "nonebot-adapter-mirai>=2.3.3", "nonebot-adapter-minecraft>=1.3.2", "nonebot-adapter-onebot>=2.4.5", - "nonebot-adapter-qq>=1.5.2", + "nonebot-adapter-qq>=1.5.3", "nonebot-adapter-red>=0.9.0", - "nonebot-adapter-satori>=0.12.6", + "nonebot-adapter-satori>=0.13.0", "nonebot-adapter-telegram>=0.1.0b18", "nonebot-adapter-kritor>=0.3.2", "nonebot-adapter-tailchat>=0.1.0b12", diff --git a/src/nonebot_plugin_alconna/uniseg/adapters/qq/exporter.py b/src/nonebot_plugin_alconna/uniseg/adapters/qq/exporter.py index 004af1b..b60a708 100644 --- a/src/nonebot_plugin_alconna/uniseg/adapters/qq/exporter.py +++ b/src/nonebot_plugin_alconna/uniseg/adapters/qq/exporter.py @@ -226,10 +226,6 @@ async def text(self, seg: Text, bot: Union[Bot, None]) -> "MessageSegment": @export async def at(self, seg: At, bot: Union[Bot, None]) -> "MessageSegment": - if TYPE_CHECKING: - assert isinstance(bot, QQBot) - if bot and bot.bot_info and bot.bot_info.is_group_bot: # TODO: 等待 QQ 机器人支持群聊下的 at - return MessageSegment.text(" ") if seg.flag == "channel": return MessageSegment.mention_channel(seg.target) elif seg.flag == "user": @@ -241,9 +237,6 @@ async def at(self, seg: At, bot: Union[Bot, None]) -> "MessageSegment": @export async def at_all(self, seg: AtAll, bot: Union[Bot, None]) -> "MessageSegment": - assert isinstance(bot, QQBot) - if bot.bot_info and bot.bot_info.is_group_bot: # TODO: 等待 QQ 机器人支持群聊下的 at - return MessageSegment.text(" ") return MessageSegment.mention_everyone() @export @@ -288,10 +281,6 @@ async def media(self, seg: Union[Image, Voice, Video, Audio, File], bot: Union[B @export async def reply(self, seg: Reply, bot: Union[Bot, None]) -> "MessageSegment": - if TYPE_CHECKING: - assert isinstance(bot, QQBot) - if bot and bot.bot_info and bot.bot_info.is_group_bot: # TODO: 等待 QQ 机器人支持群聊下的 reply - return MessageSegment.text(" ") return MessageSegment.reference(seg.id) def _button(self, seg: Button, bot: Union[Bot, None]): @@ -368,6 +357,8 @@ async def send_to(self, target: Union[Target, Event], bot: Bot, message: Message if isinstance(target, Event): assert isinstance(target, MessageEvent) + if isinstance(target, (C2CMessageCreateEvent, GroupAtMessageCreateEvent)): + message = message.exclude("mention_channel", "mention_user", "mention_everyone", "reference") return await bot.send(event=target, message=message, **kwargs) if target.channel: @@ -384,6 +375,7 @@ async def send_to(self, target: Union[Target, Event], bot: Bot, message: Message **kwargs, # type: ignore ) return await bot.send_to_channel(channel_id=target.id, message=message, msg_id=target.source, **kwargs) + message = message.exclude("mention_channel", "mention_user", "mention_everyone", "reference") if target.private: res = await bot.send_to_c2c( openid=target.id, message=message, msg_id=target.source, msg_seq=target.extra["qq.reply_seq"], **kwargs