Skip to content
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: Something went wrong #1152

Closed
RickSchanze opened this issue Aug 14, 2022 · 1 comment
Closed

Bug: Something went wrong #1152

RickSchanze opened this issue Aug 14, 2022 · 1 comment
Labels
invalid This doesn't seem right

Comments

@RickSchanze
Copy link

描述问题:

在使用on_keyword时,不正确的消息触发了关键词处理函数。

如何复现?

定义

studentunion = on_keyword("学生会哪个部门比较好玩")
@studentunion.handle()
async def studentunion_handle(event:Event, bot:Bot):
    await bot.send(event, Message(f"哪个部门都很好玩啦!"))

当获得”好玩“,”不好玩“或者一些其他消息时,该handle函数也会触发

期望的结果
仅仅在收到”学生会哪个部门比较好玩“时触发

环境信息:

  • OS: [Windows]
  • Python Version: 3.9.7
  • Nonebot Version: Nonebot2 2.0.0b4

协议端信息:

  • 协议端: [go-cqhttp]
  • 协议端版本: [e.g. v1.0.0-rc3]

截图或日志

7769B25E59680198564420EA86C1F731

@RickSchanze RickSchanze added the bug Something isn't working label Aug 14, 2022
@yanyongyu
Copy link
Member

yanyongyu commented Aug 14, 2022

请正确使用 on_keyword https://v2.nonebot.dev/docs/api/plugin/on#on_keyword

on_keyword({"key1", "key2"})

@yanyongyu yanyongyu added invalid This doesn't seem right and removed bug Something isn't working labels Aug 14, 2022
TaskManagerOL added a commit to TaskManagerOL/nonebot2 that referenced this issue Jul 4, 2024
I can't use it, I found the answer from nonebot#1152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Development

No branches or pull requests

2 participants