koishijs / docs

Documentation for Koishi
https://koishi.chat
Creative Commons Attribution Share Alike 4.0 International
13 stars 82 forks source link

目前的文档对于对于对于初学开发的人有些不友好 #14

Closed yi03 closed 1 year ago

yi03 commented 1 year ago

讲一讲我发现/遇到的问题吧。

https://koishi.chat/manual/advanced/workspace.html

开发模式 重新运行你的项目,你会立即在网页控制台的配置界面中看到 example 插件。只需点击启用,你就可以实现与机器人的对话了:

创建example插件的时候,以开发模式重新运行项目,并不会立即在网页控制台的配置界面中看到 example 插件。需要在koishi.yml添加example:{},或者在插件配置的右上角点添加插件才能看到 example 插件。

另外我有一些小的pr想提,没有找到大致的操作流程。 我目前的流程如下:

  1. 执行yarn create koishi,都使用默认选项。
  2. 进入koishi-app目录,创建plugins目录。
  3. 执行git clone https://github.com/koishijs/koishi-plugin-music plugins/music
  4. 执行yarn
  5. 执行yarn dev
  6. 添加插件添加music插件
  7. 点三角按钮启动music插件,需要点两次才能成功启动,然后控制台报[W] app duplicate plugin detected: music
  8. 在沙盒里发送music hi,控制台报错
    2022-12-09 13:19:33 [W] session music hi
                        TypeError: Cannot read properties of undefined (reading '_data')
                            at Internal._executeMatcher (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\@koishijs\core\src\internal.ts:206:42)
                            at Session.<anonymous> (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\@koishijs\core\src\internal.ts:150:14)
                            at Lifecycle.emit (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\events.ts:100:16)
                            at Context.<anonymous> (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\context.ts:73:27)
                            at Internal._process (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\@koishijs\core\src\internal.ts:282:14)
                            at next (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\@koishijs\core\src\internal.ts:342:22)
       ...
  9. ctrl c,再执行yarn dev,报错
    2022-12-09 13:20:21 [I] app apply plugin music:aninfx
    2022-12-09 13:20:22 [W] app TypeError: Cannot read properties of undefined (reading 'define')
                            at Object.apply (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\@koishijs\plugin-help\src\index.ts:65:12)
                            at MainScope.MainScope.apply (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:251:36)
                            at MainScope.start (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:281:12)
                            at MainScope.restart (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:67:10)
                            at MainScope.setup (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:246:10)
                            at MainScope (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:209:22)
                            at Map.plugin (C:\Users\allegray\koishi-bot\test\kois...
    2022-12-09 13:20:22 [W] app TypeError: Cannot read properties of undefined (reading 'define')
                            at Object.apply (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\@koishijs\plugin-sandbox\src\index.ts:119:12)
                            at MainScope.MainScope.apply (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:251:36)
                            at MainScope.start (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:281:12)
                            at MainScope.restart (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:67:10)
                            at MainScope.setup (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:246:10)
                            at MainScope (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:209:22)
                            at Map.plugin (C:\Users\allegray\koishi-bot\test\...
    2022-12-09 13:20:22 [W] app TypeError: Cannot read properties of undefined (reading 'extend')
                            at MetaProvider (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\@koishijs\plugin-status\src\meta.ts:34:15)
                            at MainScope.MainScope.apply (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:255:24)
                            at MainScope.start (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:281:12)
                            at MainScope.restart (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:67:10)
                            at MainScope.setup (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:246:10)
                            at MainScope (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:209:22)
                            at Map.plugin (C:\Users\allegray\koishi-bot\test\koi...
    2022-12-09 13:20:22 [W] app TypeError: Cannot read properties of undefined (reading 'tables')
                            at SQLiteDriver (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\@minatojs\driver-sqlite\src\index.ts:94:43)
                            at Object.apply (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\@koishijs\core\src\database.ts:197:20)
                            at MainScope.apply (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:251:36)
                            at ForkScope.start (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:177:32)
                            at ForkScope (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:171:10)
                            at MainScope.fork (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:223:12)
                            at Map.plugin (C:\Users\allegray\koishi-bot\test\koishi...
    2022-12-09 13:20:22 [W] app TypeError: Cannot read properties of undefined (reading 'command')
                            at Context.<anonymous> (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\context.ts:73:21)
                            at Object.apply (c:\Users\allegray\koishi-bot\test\koishi-app\plugins\music\src\index.ts:59:7)
                            at MainScope.MainScope.apply (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:251:36)
                            at MainScope.start (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:281:12)
                            at MainScope.restart (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:67:10)
                            at MainScope.setup (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:246:10)
                            at MainScope (C:\Users\allegray\koishi-bot\test\koishi-app\node...
    2022-12-09 13:20:22 [E] app TypeError: Cannot read properties of undefined (reading 'define')
                            at Object.apply (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\@koishijs\cli\src\worker\daemon.ts:61:12)
                            at MainScope.MainScope.apply (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:251:36)
                            at MainScope.start (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:281:12)
                            at MainScope.restart (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:67:10)
                            at MainScope.setup (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:246:10)
                            at MainScope (C:\Users\allegray\koishi-bot\test\koishi-app\node_modules\cordis\src\scope.ts:209:22)
                            at Map.plugin (C:\Users\allegray\koishi-bot\test\kois...
    error Command failed with exit code 1.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

换成bvid插件也是一样的错。 但是换成novelai插件的话就一切正常,换成novelai插件我第3步改成了执行git clone https://github.com/koishijs/novelai-bot plugins/novelai

shigma commented 1 year ago

https://koishi.chat/guide/develop/workspace.html

我们已经根据你提出的宝贵意见改进了工作区开发的相关文档。你看看现在怎么样?

yi03 commented 1 year ago

https://koishi.chat/guide/develop/workspace.html

我们已经根据你提出的宝贵意见改进了工作区开发的相关文档。你看看现在怎么样?

我觉得没问题。感谢改进。

shigma commented 1 year ago

ok 那我先关闭这个 issue 了,后续有建议也欢迎提出。