mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-23 06:10:30 +08:00
Fix incorrect new contact handling
This commit is contained in:
parent
b4140b7871
commit
df9a5f7c0a
@ -78,6 +78,7 @@ internal class QQAndroidBot constructor(
|
||||
configuration: BotConfiguration
|
||||
) : QQAndroidBotBase(context, account, configuration) {
|
||||
|
||||
@OptIn(LowLevelAPI::class)
|
||||
override suspend fun acceptNewFriendRequest(event: NewFriendRequestEvent) {
|
||||
check(event.responded.compareAndSet(expect = false, update = true)) {
|
||||
"the request $this has already been responded"
|
||||
@ -89,6 +90,10 @@ internal class QQAndroidBot constructor(
|
||||
event,
|
||||
accept = true
|
||||
).sendWithoutExpect()
|
||||
bot.friends.delegate.addLast(bot._lowLevelNewQQ(object : FriendInfo {
|
||||
override val uin: Long get() = event.fromId
|
||||
override val nick: String get() = event.fromNick
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,7 +124,11 @@ internal class QQAndroidBot constructor(
|
||||
event,
|
||||
accept = true
|
||||
).sendWithoutExpect()
|
||||
bot.friends.delegate.addLast(bot._lowLevelNewQQ(object : FriendInfo {
|
||||
event.group.members.delegate.addLast(event.group.newMember(object : MemberInfo {
|
||||
override val nameCard: String get() = ""
|
||||
override val permission: MemberPermission get() = MemberPermission.MEMBER
|
||||
override val specialTitle: String get() = ""
|
||||
override val muteTimestamp: Int get() = 0
|
||||
override val uin: Long get() = event.fromId
|
||||
override val nick: String get() = event.fromNick
|
||||
}))
|
||||
@ -138,14 +147,6 @@ internal class QQAndroidBot constructor(
|
||||
accept = false,
|
||||
blackList = blackList
|
||||
).sendWithoutExpect()
|
||||
event.group.members.delegate.addLast(event.group.newMember(object : MemberInfo {
|
||||
override val nameCard: String get() = ""
|
||||
override val permission: MemberPermission get() = MemberPermission.MEMBER
|
||||
override val specialTitle: String get() = ""
|
||||
override val muteTimestamp: Int get() = 0
|
||||
override val uin: Long get() = event.fromId
|
||||
override val nick: String get() = event.fromNick
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -509,7 +509,7 @@ data class NewFriendRequestEvent(
|
||||
/**
|
||||
* 群名片或好友昵称
|
||||
*/
|
||||
val nick: String
|
||||
val fromNick: String
|
||||
) : BotEvent, Packet {
|
||||
internal val responded: AtomicBoolean = atomic(false)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user