koishijs / koishi

Cross-platform chatbot framework made with love
https://koishi.chat
MIT License
4.4k stars 242 forks source link

Bug: Telegram 群聊报错 #1314

Closed Ice-Hazymoon closed 9 months ago

Ice-Hazymoon commented 9 months ago

Describe the bug

session.argv undefined

image

 app TypeError: Cannot set properties of undefined (setting 'root')
                            at Proxy.<anonymous> (E:\Project\bot\node_modules\@koishijs\core\src\command\index.ts:71:22)    
                            at Proxy.emit (E:\Project\bot\node_modules\cordis\src\events.ts:99:16)
                            at _TelegramBot.dispatch (E:\Project\bot\node_modules\@satorijs\core\src\bot.ts:157:20)
                            at handleUpdate (E:\Project\bot\node_modules\@satorijs\adapter-telegram\src\utils.ts:105:7)     
                            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Steps to reproduce

如题

Expected behavior

如题

Screenshots

No response

Versions

{
    "@koishijs/plugin-adapter-discord": "^4.1.7",
    "@koishijs/plugin-adapter-lark": "3.2.0",
    "@koishijs/plugin-adapter-line": "2.2.0",
    "@koishijs/plugin-adapter-mail": "^2.1.3",
    "@koishijs/plugin-adapter-slack": "^2.1.0",
    "@koishijs/plugin-adapter-telegram": "^4.2.0",
    "@koishijs/plugin-adapter-whatsapp": "^2.2.0",
    "@koishijs/plugin-admin": "^1.4.0",
    "@koishijs/plugin-auth": "^4.1.6",
    "@koishijs/plugin-bind": "^1.4.5",
    "@koishijs/plugin-commands": "^3.4.3",
    "@koishijs/plugin-config": "^2.7.0",
    "@koishijs/plugin-console": "^5.22.0",
    "@koishijs/plugin-database-mysql": "5.7.4",
    "@koishijs/plugin-dataview": "^2.3.1",
    "@koishijs/plugin-explorer": "^1.5.0",
    "@koishijs/plugin-hmr": "^1.2.6",
    "@koishijs/plugin-insight": "^3.4.4",
    "@koishijs/plugin-locales": "^2.5.1",
    "@koishijs/plugin-logger": "^2.6.1",
    "@koishijs/plugin-market": "2.7.1",
    "@koishijs/plugin-sandbox": "3.2.2",
    "@koishijs/plugin-server": "^3.1.3",
    "@koishijs/plugin-status": "^7.3.0",
    "koishi": "^4.16.1",
    "koishi-plugin-assets-local": "^3.2.0",
    "koishi-plugin-message-logger": "2.0.0",
    "@koishijs/client": "^5.22.0",
    "@koishijs/scripts": "^4.5.0",
  }

Additional context

No response

shigma commented 9 months ago

方便给一下 session.content 完整内容吗?

Ice-Hazymoon commented 9 months ago

我记得是空的,所以args解析出来也是空的

shigma commented 9 months ago
image

空的也能触发 bot command 吗?能看下输入内容吗?

Ice-Hazymoon commented 9 months ago

内容应该是

/help@bot_name

session.content 是空的,但是 session.stripped.content 是有内容的,我不知道这俩参数有啥区别,我把 https://github.com/koishijs/koishi/blob/master/packages%2Fcore%2Fsrc%2Fcommand%2Findex.ts#L78-L84 这部分的内容加在了 interaction/command 函数里就不报错了,勉强能临时用用

shigma commented 9 months ago

Koishi 侧的修复已经完成了,下个版本实装。

Telegram 适配器的部分稍后补上。

如果更新 Koishi 后仍然有此问题,可以 reopen。