We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
描述问题:
插件若在 nonebot 启动后再动态创建 Matcher,这些 Matcher 的 plugin_name 属性为 None,而很多管理类插件需要用到 matcher.plugin_name
如何复现?
在 nonebot 启动后创建 Matcher,如在 on_startup 中创建 Matcher
示例:nonebot-plugin-memes-api 插件在 on_startup 中创建 Matcher: code
有些 bot 直接使用 matcher.plugin_name,导致如下的报错:
期望的结果
由于 nonebot 中 Matcher 的 plugin_name 属性为 Optional,不确定这一结果是否是预期行为?
如果是,有没有好的办法在动态创建 Matcher 时定义 plugin_name 呢?
The text was updated successfully, but these errors were encountered:
plugin相关属性目前只有在插件导入时可以进行跟踪,但是module属性应该是有的,可以考虑通过module寻找plugin
Sorry, something went wrong.
这边遇到了一个小问题,运行时插件新建的matcher是否应该添加到plugin.matcher存储里
plugin.matcher
目前做法是仅加载期间的响应器会被添加到插件对象存储里,为了防止运行时内存泄露
Successfully merging a pull request may close this issue.
描述问题:
插件若在 nonebot 启动后再动态创建 Matcher,这些 Matcher 的 plugin_name 属性为 None,而很多管理类插件需要用到 matcher.plugin_name
如何复现?
在 nonebot 启动后创建 Matcher,如在 on_startup 中创建 Matcher
示例:nonebot-plugin-memes-api 插件在 on_startup 中创建 Matcher: code
有些 bot 直接使用 matcher.plugin_name,导致如下的报错:
期望的结果
由于 nonebot 中 Matcher 的 plugin_name 属性为 Optional,不确定这一结果是否是预期行为?
如果是,有没有好的办法在动态创建 Matcher 时定义 plugin_name 呢?
The text was updated successfully, but these errors were encountered: