-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
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
[BUG] 优先级更改或者修改成别的触发模式,/say这种 #16
Comments
优先级可以使用priority实现,正打算考虑加入新的响应如 |
我根据gpt的把init.py的handle改成了这个样子,但是好像还是会被别的插件读取信息。
问一下他有什么办法能让他不拦截信息吗?就比如说这个插件虽然他被matcher select了但是他不会停留在这,会接着流向下一个插件这种,如果能这样的话就不用调优先度了。我试着去找了一下那个会吞并这个插件消息的message的priority但是我没找到,或者说是没有找到同样写法的priority,是这两个nonebot-plugin-updater, nonebot-plugin-running-state. 我对这些代码的认知仅停留在gpt修改还有英语阅读上,如果您能提供一些处理的建议之类的,或者如何把这些handler改成指令的形式的话,感激不尽 |
@watshon14 源码对应在这里修改 |
请问插件的block和优先度都是这么写的吗?还是也有可能会有别的方法去handle,我看了一下别的插件的源代码好像有一些没有和这个完全一致的写法,也有可能是我阅读失误了。如果他没有的话能直接这么写给他的function加一个 |
是的,但这不是插件的优先度和阻断性,更确切的说是指具体响应器(matcher)的优先度与阻断性,一个插件可含有多个matcher,用于处理相关的消息。 matcher1 = on_message('hello',priority=5,block=False)
matcher2 = on_regex(r'^hello,world$',priority=6,block=True)
@matcher1.handle()
async def _():
#matcher1处理hello消息的逻辑
...
@matcher2.handle()
async def _();
#matcher2处理hello,world消息的逻辑
... 这些参数使得matcher按照开发者设计要求响应消息 |
前面提到的nonebot-plugin-updater插件等,用到另外一种匹配器Alconna,这里不展开详述。同样的在源码这里可以添加 |
好的,谢谢您的指点。更详细的问一下,用Alconna的matcher的话,写priority和block的argument是在您标出来的 |
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
这个插件的信息经常会被别的优先级更高的插件使用同样message格式导致matcher 不会正确选择
Describe the solution you'd like
A clear and concise description of what you want to happen.
请问怎么修改触发模式,修改成/say这种的触发模式或者修改别的插件降低别的的优先度,没有写过插件的经验不太确定这些修改在哪里完成
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: