Skip to content

Feature: 使用新版 mention 格式 - #223

Open
Yushu2606 wants to merge 6 commits into
nonebot:masterfrom
Yushu2606:master
Open

Feature: 使用新版 mention 格式#223
Yushu2606 wants to merge 6 commits into
nonebot:masterfrom
Yushu2606:master

Conversation

@Yushu2606

@Yushu2606 Yushu2606 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

@Yushu2606
Yushu2606 marked this pull request as draft August 11, 2026 04:58
@Yushu2606

Yushu2606 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

实测原实现与本PR都无法正确将字面量转换为at标签,需要更多信息

@Yushu2606

Yushu2606 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

实测原实现与本PR都无法正确将字面量转换为at标签,需要更多信息

at标签可能仅在主动markdown中支持

@Yushu2606 Yushu2606 changed the title fix: 更新提及用户和提及所有人的字符串格式 fix: 更新提及的字符串格式,并在其使用时升级为markdown Aug 11, 2026
@Yushu2606
Yushu2606 marked this pull request as ready for review August 11, 2026 05:32
@yanyongyu

Copy link
Copy Markdown
Member

text 隐式转成 markdown 不太合理吧,会出现不符合预期的格式问题,如果不可用应该由用户显式切换消息为 markdown

@Yushu2606

Yushu2606 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

text 隐式转成 markdown 不太合理吧,会出现不符合预期的格式问题,如果不可用应该由用户显式切换消息为 markdown

原实现的静默失败也不太合理,而且这个pr有加转义的…或者再加个启用自动升级的字段?或者at段被用在text消息时抛异常?

@yanyongyu

Copy link
Copy Markdown
Member

抛异常或者 warning 如果后续服务端支持了用户又不能用,也不太合理,我建议这个格式问题用文档说明更好,用户在调试时发现问题能知道如何解决即可

@Yushu2606

Yushu2606 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

那我先给启用自动升级加个参吧
text与markdown的混排与互斥可能存在更严重的问题(#225),这个pr先恢复到最开始的目的

@yanyongyu

yanyongyu commented Aug 13, 2026

Copy link
Copy Markdown
Member

我不太能接受这种自动升级,应该由用户在代码里手动转换为 markdown segment。另外你的转义也是不可靠的,其他例如 ![]() 都没有转义,如果要完整转义会引入更多依赖。

@Yushu2606
Yushu2606 marked this pull request as draft August 13, 2026 05:25
@Yushu2606 Yushu2606 changed the title fix: 更新提及的字符串格式,并在其使用时升级为markdown fix: 更新提及的字符串格式 Aug 13, 2026
@Yushu2606
Yushu2606 marked this pull request as ready for review August 13, 2026 05:47
@yanyongyu

yanyongyu commented Aug 13, 2026

Copy link
Copy Markdown
Member

我看 #220 里能正常发送带 at 的 text,应该不是只有 markdown 可用吧。

另外接收到的事件里的消息是否需要解析新格式的 at?

@yanyongyu yanyongyu added the enhancement New feature or request label Aug 13, 2026
@yanyongyu yanyongyu changed the title fix: 更新提及的字符串格式 Feature: 使用新版 mention 格式 Aug 13, 2026
@Yushu2606

Yushu2606 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

我看 #220 里能正常发送带 at 的 text,应该不是只有 markdown 可用吧。

另外接收到的事件里的消息是否需要解析新格式的 at?

text 发送 at 至少我没能成功复现
解析已经在使用新格式了?

elif embed.group("type1") == "qqbot-at-user":
yield MentionUser("mention_user", {"user_id": embed.group("id1")})

@Yushu2606

Yushu2606 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor Author

补了对 at 全体的解析,另外扣掉 @everyone 的逻辑我不确定该不该去掉

@yanyongyu

Copy link
Copy Markdown
Member

旧的逻辑应该不会收到了吧,我觉得都可以去掉了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

Feature: 新版 mention 格式

2 participants