Skip to content

Commit

Permalink
fix exception when userId not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
MrXiaoM committed Jan 6, 2024
1 parent a6e9521 commit 17c4f38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ internal class FriendAddRequestListener(
message = e.comment,
fromId = e.userId,
fromGroupId = 0, // TODO: 获取来自哪个群
fromNick = bot.queryProfile(e.userId) { nickname } ?: ""
fromNick = e.userId.takeIf { it > 0 }?.run { bot.queryProfile(this) { nickname } } ?: ""
).broadcast()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ internal class GroupAddRequestListener(
fromId = e.userId,
groupId = e.groupId,
groupName = bot.getGroup(e.groupId)?.name ?: e.groupId.toString(),
fromNick = bot.queryProfile(e.userId) { nickname } ?: "",
fromNick = e.userId.takeIf { it > 0 }?.run { bot.queryProfile(this) { nickname } } ?: "",
invitorId = null // TODO: 获取邀请者
).broadcast()
}
Expand All @@ -130,7 +130,7 @@ internal class GroupAddRequestListener(
invitorId = e.userId,
groupId = e.groupId,
groupName = bot.getGroup(e.groupId)?.name ?: e.groupId.toString(),
invitorNick = bot.queryProfile(e.userId) { nickname } ?: ""
invitorNick = e.userId.takeIf { it > 0 }?.run { bot.queryProfile(this) { nickname } } ?: ""
).broadcast()
}
}
Expand Down

0 comments on commit 17c4f38

Please sign in to comment.