Skip to content

Commit

Permalink
⬆️ upgrade
Browse files Browse the repository at this point in the history
resolve #82
  • Loading branch information
RF-Tar-Railt committed Dec 11, 2024
1 parent d44be02 commit 9a15542
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
8 changes: 4 additions & 4 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 3 additions & 11 deletions src/nonebot_plugin_alconna/uniseg/adapters/qq/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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
Expand Down Expand Up @@ -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]):
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 9a15542

Please sign in to comment.