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

使用koishi-plugin-common的bind指令时抛出异常 #152

Closed
Anillc opened this issue Mar 14, 2021 · 2 comments
Closed

使用koishi-plugin-common的bind指令时抛出异常 #152

Anillc opened this issue Mar 14, 2021 · 2 comments

Comments

@Anillc
Copy link
Member

Anillc commented Mar 14, 2021

Describe the bug

在onebot平台上使用bind指令后到telegram平台发送token后报错

To Reproduce

使用koishi-plugin-mysqlkoishi-plugin-common以及参数autoAuthorize: 1

Expected behavior

user表中telegram字段更新

Screenshots

Screenshot_20210314_161431

Versions

  • OS: CentOS 8
  • Node Version: 14.15.3
  • Koishi Version: 3.1.0
  • koishi-plugin-mysql Version: 3.0.0
  • koishi-plugin-common Version: 4.1.0

Additional context

推测原因:

  • user表中onebot和telegram有UNIQUE修饰
  • 使用autoAuthorize: 1参数后会自动在表中分别插入onebot和telegram的user
  • bind指令不会自动删除已有的user,导致字段内容重复,抛出异常

另外如果不使用autoAuthorize: 1,会导致在telegram端返回权限不足的提示

@shigma
Copy link
Member

shigma commented Mar 15, 2021

@Anillc 感谢你的反馈!问题已于 de3baaa 解决,但你对这个指令的行为理解有误。

另外如果不使用 autoAuthorize: 1,会导致在 telegram 端返回权限不足的提示

这是因为账户只能绑定已经存在的账户,onebot 不能与不存在的 telegram 账户绑定。

因此,如果你已有 onebot 账户,而没有 telegram 账户的话,应该在 telegram 而不是 onebot 中使用 bind 指令,不然 onebot 会被销号。

@Anillc
Copy link
Member Author

Anillc commented Mar 15, 2021

@Anillc 感谢你的反馈!问题已于 de3baaa 解决,但你对这个指令的行为理解有误。

另外如果不使用 autoAuthorize: 1,会导致在 telegram 端返回权限不足的提示

这是因为账户只能绑定已经存在的账户,onebot 不能与不存在的 telegram 账户绑定。

因此,如果你已有 onebot 账户,而没有 telegram 账户的话,应该在 telegram 而不是 onebot 中使用 bind 指令,不然 onebot 会被销号。

明白了,感谢回复

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