From 89386904b1fece351706d96e8082cad1bc92d788 Mon Sep 17 00:00:00 2001 From: Karlatemp Date: Tue, 23 Jun 2020 13:22:15 +0800 Subject: [PATCH] Fix #383 --- .../mirai/qqandroid/QQAndroidBot.common.kt | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.common.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.common.kt index 1d2dcbd4b..3d38e3726 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.common.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.common.kt @@ -705,7 +705,13 @@ internal abstract class QQAndroidBotBase constructor( @LowLevelAPI @MiraiExperimentalAPI - override suspend fun _lowLevelSolveNewFriendRequestEvent(eventId: Long, fromId: Long, fromNick: String, accept: Boolean, blackList: Boolean) { + override suspend fun _lowLevelSolveNewFriendRequestEvent( + eventId: Long, + fromId: Long, + fromNick: String, + accept: Boolean, + blackList: Boolean + ) { network.apply { NewContact.SystemMsgNewFriend.Action( bot.client, @@ -761,16 +767,17 @@ internal abstract class QQAndroidBotBase constructor( accept = accept, blackList = blackList ).sendWithoutExpect() - groups[groupId].apply { - members.delegate.addLast(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() = fromId - override val nick: String get() = fromNick - })) - } + if (accept ?: return) + groups[groupId].apply { + members.delegate.addLast(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() = fromId + override val nick: String get() = fromNick + })) + } } }