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

plugin-teach 2.0.1 + mongo 无法正常触发问题 #185

Closed
dragon-fish opened this issue Mar 25, 2021 · 3 comments
Closed

plugin-teach 2.0.1 + mongo 无法正常触发问题 #185

dragon-fish opened this issue Mar 25, 2021 · 3 comments
Assignees

Comments

@dragon-fish
Copy link
Member

dragon-fish commented Mar 25, 2021

Describe the bug

koishi-core3.3.0升级到3.4.0,、teach从2.0.0升级到2.0.1时,新增的问题如果回答包含插值语法(例如$(echo 123))时,无法被正常触发、修改、查询。

To Reproduce

使用 koishi 3.4.0 + plugin-teach 2.0.1 + plugin-mongo 2.2.0

假定问答前缀为 ?!,添加的问题编号为40:

> ?! 测试问题 $(echo 测试回复)
< 问答已添加,编号为 40。
> 测试问题
< (无回应,控制台【无】报错)
> ?!40
< (无回应,控制台报错)
> ?!40 -d
< (无回应,控制台报错)

Expected behavior

带有插值语法的教学能够正常工作,能够正常编辑

Screenshots

[I] MAIN ✉ [onebot] 收到群消息 群123456 用户名(654321) ?!40
[W] command executing command: ?!40
    TypeError: Cannot convert undefined or null to object
        at Function.entries (<anonymous>)
        at clone (C:\QQbot-SILI\node_modules\koishi-utils\dist\index.js:445:126)
        at C:\QQbot-SILI\node_modules\koishi-utils\dist\index.js:445:170
        at Array.map (<anonymous>)
        at clone (C:\QQbot-SILI\node_modules\koishi-utils\dist\index.js:445:142)
        at C:\QQbot-SILI\node_modules\koishi-plugin-teach\dist\index.js:980:93
        at Array.forEach (<anonymous>)
        at MongoDatabase.getDialoguesById (C:\QQbot-SILI\node_modules\koishi-plugin-teach\dist\index.js:977:15)
[I] MAIN ✉ [onebot] 收到群消息 群123456 用户名(654321) ?!40 -d
[W] command executing command: ?!40 -d
    TypeError: Cannot convert undefined or null to object
        at Function.entries (<anonymous>)
        at clone (C:\QQbot-SILI\node_modules\koishi-utils\dist\index.js:445:126)
        at C:\QQbot-SILI\node_modules\koishi-utils\dist\index.js:445:170
        at Array.map (<anonymous>)
        at clone (C:\QQbot-SILI\node_modules\koishi-utils\dist\index.js:445:142)
        at C:\QQbot-SILI\node_modules\koishi-plugin-teach\dist\index.js:980:93
        at Array.forEach (<anonymous>)
        at MongoDatabase.getDialoguesById (C:\QQbot-SILI\node_modules\koishi-plugin-teach\dist\index.js:977:15)

Versions

  • koishi 3.4.0

  • koishi-plugin-mongo 2.2.0

  • koishi-plugin-teach 2.0.1

  • OS: [e.g. iOS]

  • Node Version: [e.g. 10.16.0] 15.4.0

  • CoolQ Version: [e.g. 5.15.4] -

  • CQHTTP Version: [e.g. 4.13.2] -

  • Koishi Version: [e.g. 1.0.0] 3.4.0

Additional context

@dragon-fish
Copy link
Member Author

dragon-fish commented Mar 25, 2021

另注:回答中不包含插值语法(例如 $(echo 123))时,一切正常

@dragon-fish
Copy link
Member Author

dragon-fish commented Mar 25, 2021

修正:回答中不包含插值语法时,问题能够正常触发回答,但是编辑问题时报错(例如 #40 #40 -d #40 ~ "foo" 等操作均无效)

假定问答前缀为 ?!,添加的问题编号为41:

> ?! 你好 我好
< 问答已添加,编号为 41。
> 你好
< 我好
> ?!41
< (无回应,控制台报错)
> ?!41 -E
< (无回应,控制台报错)

报错同上

@dragon-fish
Copy link
Member Author

另提供两个问答在数据库中的document

问题40(?! 测试问题 $(echo 测试回复)

{
    "_id": 40,
    "flag": 0,
    "answer": "$(echo 测试回复)",
    "question": "测试问题",
    "original": "测试问题",
    "groups": ["onebot:123456"],
    "probS": 1,
    "probA": 0,
    "predecessors": [],
    "startTime": 0,
    "endTime": 0,
    "writer": "81add3aa-85ea-4c4b-8922-03aa84177977"
}

问题41(?! 你好 我好

{
    "_id": 41,
    "flag": 0,
    "answer": "我好",
    "question": "你好",
    "original": "你好",
    "groups": ["onebot:123456"],
    "probS": 1,
    "probA": 0,
    "predecessors": [],
    "startTime": 0,
    "endTime": 0,
    "writer": "81add3aa-85ea-4c4b-8922-03aa84177977"
}

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

No branches or pull requests

2 participants