mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-21 11:36:57 +08:00
Filter out duplicated GroupTalkativeChangeEvent and relevant events with same subject. Fix #1707
This commit is contained in:
parent
aa53d92fbe
commit
10af69f05e
@ -12,6 +12,7 @@
|
||||
|
||||
package net.mamoe.mirai.internal.contact
|
||||
|
||||
import kotlinx.atomicfu.atomic
|
||||
import net.mamoe.mirai.LowLevelApi
|
||||
import net.mamoe.mirai.Mirai
|
||||
import net.mamoe.mirai.contact.*
|
||||
@ -114,6 +115,7 @@ internal class GroupImpl constructor(
|
||||
override val filesRoot: RemoteFile by lazy { RemoteFileImpl(this, "/") }
|
||||
override val files: RemoteFiles by lazy { RemoteFilesImpl(this) }
|
||||
|
||||
val lastTalkative = atomic<NormalMemberImpl?>(null)
|
||||
|
||||
override val announcements: Announcements by lazy {
|
||||
AnnouncementsImpl(
|
||||
|
@ -347,8 +347,12 @@ internal class GroupNotificationProcessor(
|
||||
}
|
||||
// 龙王
|
||||
10093L, 1053L, 1054L -> {
|
||||
val now: NormalMember = grayTip.msgTemplParam["uin"]?.findMember() ?: group.botAsMember
|
||||
val previous: NormalMember? = grayTip.msgTemplParam["uin_last"]?.findMember()
|
||||
val now = grayTip.msgTemplParam["uin"]?.findMember() ?: group.botAsMember
|
||||
val previous = grayTip.msgTemplParam["uin_last"]?.findMember()
|
||||
|
||||
val lastTalkative = group.lastTalkative.value
|
||||
if (lastTalkative == now) return // duplicate
|
||||
if (!group.lastTalkative.compareAndSet(lastTalkative, now)) return
|
||||
|
||||
if (previous == null) {
|
||||
collect(MemberHonorChangeEvent.Achieve(now, GroupHonorType.TALKATIVE))
|
||||
|
Loading…
Reference in New Issue
Block a user