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

当机器人账号设置为允许任何人添加好友时,mirai的联系人缓存机制会导致Bot.getFriends()抛出异常无法找到新添加的好友。 #1546

Closed
FlyRenxing opened this issue Sep 11, 2021 · 1 comment · Fixed by #1549
Labels
x:question 标签: 需要更多信息

Comments

@FlyRenxing
Copy link

当机器人账号设置为允许任何人添加好友时,mirai的联系人缓存机制会导致Bot.getFriends()抛出异常无法找到新添加的好友。重启项目后再次运行Bot.getFriends()又可以找到好友了。

因生产环境...并没有详细的日志。希望能提供好友申请事件时自动刷新缓存的功能


复现

  1. 设置允许任何人添加好友后登录机器人。
  2. 任意账号添加机器人为好友。
  3. 调用getFriend方法会抛出无法找到联系人的异常

版本及相关选项选择

  • mirai-core: 2.7
  • bot-protocol: ANDROID_PHONE

网络日志


补充信息

@FlyRenxing FlyRenxing added the x:question 标签: 需要更多信息 label Sep 11, 2021
sandtechnology added a commit to sandtechnology/mirai that referenced this issue Sep 11, 2021
@sandtechnology
Copy link
Collaborator

当机器人账号设置为允许任何人添加好友时,你得到的并不是好友,而是陌生人,关于好友申请事件的bug已提交PR修复

@Him188 Him188 linked a pull request Sep 11, 2021 that will close this issue
Him188 added a commit that referenced this issue Sep 12, 2021
* Fix #1546, revert wrong changes and request system messages when getting stranger

* Use faster long array

Co-authored-by: Him188 <Him188@mamoe.net>

Co-authored-by: Him188 <Him188@mamoe.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:question 标签: 需要更多信息
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants