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

好友修改昵称时有正确广播事件但没有修改 Friend 的属性 #1674

Closed
dellbeat opened this issue Nov 15, 2021 · 3 comments · Fixed by #1678
Closed

好友修改昵称时有正确广播事件但没有修改 Friend 的属性 #1674

dellbeat opened this issue Nov 15, 2021 · 3 comments · Fixed by #1678
Labels
N 优先级: 一般 t:bug 类型: bug
Milestone

Comments

@dellbeat
Copy link

现在将BOT的好友,昵称为A修改为昵称B,会在console显示事件
Event: FriendNickChangedEvent(friend=Friend(XXX), from=A, to=B)
但是如果尝试将昵称从B修改回A则不会触发 而且有个细节是 如果从昵称B直接修改为昵称C 触发的事件记录如下图所示
Event: FriendNickChangedEvent(friend=Friend(XXX), from=A, to=C)

Event: FriendNickChangedEvent(friend=Friend(XXX), from=A, to=B)
Event: FriendNickChangedEvent(friend=Friend(XXX), from=A, to=C)

复现

1.将BOT的好友昵称从A修改为B
2.再将该好友的昵称从B修改为A(或者修改为C也可)

版本及相关选项选择

  • mirai-core: 2.8.0
  • bot-protocol: ANDROID_PAD
  • mirai-api-http: 2.3.0

网络日志

补充信息

@dellbeat dellbeat added the x:question 标签: 需要更多信息 label Nov 15, 2021
@Him188 Him188 changed the title 好友修改昵称时事件的触发问题 好友修改昵称时有正确广播事件但没有修改 Friend 的属性 Nov 15, 2021
@Him188 Him188 added t:bug 类型: bug N 优先级: 一般 and removed x:question 标签: 需要更多信息 labels Nov 15, 2021
@Him188 Him188 added this to the Backlog milestone Nov 15, 2021
@sandtechnology
Copy link
Collaborator

sandtechnology commented Nov 16, 2021

这个问题修过了(b0e25a5 ) 理论上不存在这种行为

20002 -> { // 昵称修改
val to = profileInfo.value
if (body.uin == bot.id) {
val from = bot.nick
if (from == to) continue
collect(BotNickChangedEvent(bot, from, to))
bot.nick = to
} else {
val friend = bot.getFriend(body.uin)?.impl() ?: continue
val from = friend.nick
if (from == to) continue
collect(FriendNickChangedEvent(friend, from, to))
friend.info.nick = to

@dellbeat
Copy link
Author

这个问题修过了(b0e25a5 ) 理论上不存在这种行为

20002 -> { // 昵称修改
val to = profileInfo.value
if (body.uin == bot.id) {
val from = bot.nick
if (from == to) continue
collect(BotNickChangedEvent(bot, from, to))
bot.nick = to
} else {
val friend = bot.getFriend(body.uin)?.impl() ?: continue
val from = friend.nick
if (from == to) continue
collect(FriendNickChangedEvent(friend, from, to))
friend.info.nick = to

请问是2.8.0版本么 我再去验证一下

@sandtechnology
Copy link
Collaborator

这个问题修过了(b0e25a5 ) 理论上不存在这种行为

20002 -> { // 昵称修改
val to = profileInfo.value
if (body.uin == bot.id) {
val from = bot.nick
if (from == to) continue
collect(BotNickChangedEvent(bot, from, to))
bot.nick = to
} else {
val friend = bot.getFriend(body.uin)?.impl() ?: continue
val from = friend.nick
if (from == to) continue
collect(FriendNickChangedEvent(friend, from, to))
friend.info.nick = to

请问是2.8.0版本么 我再去验证一下

发现bug原因了 会发送PR修复

sandtechnology added a commit to sandtechnology/mirai that referenced this issue Nov 16, 2021
@Him188 Him188 linked a pull request Nov 16, 2021 that will close this issue
Him188 added a commit that referenced this issue Nov 16, 2021
* Fix #1674, apply right nick and remark impl for contact design

* Fix build, add missed member impl

* Fix wrong delegate in AbstractMember impl

Co-authored-by: sandtechnology <a1294790523@hotmail.com>

Co-authored-by: Him188 <him188@mamoe.net>
@Him188 Him188 modified the milestones: Backlog, 2.9.0-M1 Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
N 优先级: 一般 t:bug 类型: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants