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: Telegram 适配器添加账号时发生错误 #693

Closed
Tracked by #662
idranme opened this issue May 23, 2022 · 5 comments
Closed
Tracked by #662

Bug: Telegram 适配器添加账号时发生错误 #693

idranme opened this issue May 23, 2022 · 5 comments

Comments

@idranme
Copy link

idranme commented May 23, 2022

Describe the bug

[E] bot TypeError: Cannot read properties of undefined (reading 'getMe')
                            at _TelegramBot.getLoginInfo (\node_modules\@koishijs\plugin-adapter-telegram\src\bot.ts:258:38)
                            at HttpPolling.connect (\node_modules\@koishijs\plugin-adapter-telegram\src\http.ts:13:62)
                            at _TelegramBot.start (\node_modules\@koishijs\core\src\protocol\bot.ts:85:26)
                            at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Steps to reproduce

yarn dev
使用网页控制台添加 Telegram 机器人

Expected behavior

能正常添加 Telegram 机器人

Screenshots

No response

Versions

  • OS: Windows 11
  • Platform: Telegram
  • Node version: 18.2.0
  • Koishi version: 4.7.1

Additional context

No response

@Anillc
Copy link
Member

Anillc commented May 24, 2022

看上去是 schemastery 的问题。

Schema.array[] 处理的返回结果不应该往里面添加元素,实测在

return { name, Config, apply }

这个位置的 Config, 如果对他传递一个 {}, 他返回的对象里 bot 属性中会有一个不正确的值

这会导致

this.app.plugin(plugin, this.interpolate(config))

这里加载 plugin 失败并抛出异常导致

this.loader.reloadPlugin(name)

这里的初始化并没有完成就退出了。但是这个时候 adapter 的状态被标记为了加载成功

所以点第二次 登录帐号 的时候会报错 $internal undefined, 因为实际上 adapter 并没有成功加载

@shigma shigma added this to the 4.8 milestone May 25, 2022
@shigma
Copy link
Member

shigma commented Jun 9, 2022

使用网页控制台添加 Telegram 机器人

你的具体操作是什么?操作前的配置文件是最新的吗?

@shigma
Copy link
Member

shigma commented Jun 9, 2022

已尝试修复此问题。目前的行为:

  • 如果已有配置正确的适配器插件写在配置文件中,则能够正常添加
  • 如果配置文件中没有适配器插件,则能够正常通过「机器人」界面添加
  • 如果先在「插件配置」界面添加适配器插件,会导致生成错误的配置项

其中 2 属于本次修复的部分,3 目前暂时无法解决,需要等适配器插件的下一个大版本。

请使用最新版本(473 / 190)验证此行为。

@idranme
Copy link
Author

idranme commented Jun 9, 2022

已尝试修复此问题。目前的行为:

  • 如果已有配置正确的适配器插件写在配置文件中,则能够正常添加
  • 如果配置文件中没有适配器插件,则能够正常通过「机器人」界面添加
  • 如果先在「插件配置」界面添加适配器插件,会导致生成错误的配置项

其中 2 属于本次修复的部分,3 目前暂时无法解决,需要等适配器插件的下一个大版本。

请使用最新版本(473 / 190)验证此行为。

谢谢你!

@idranme
Copy link
Author

idranme commented Jun 10, 2022

使用网页控制台添加 Telegram 机器人

你的具体操作是什么?操作前的配置文件是最新的吗?

  • yarn dev
  • 打开控制台
  • 转到“机器人”页面
  • 添加机器人

配置文件是最新的

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

3 participants