mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-26 16:10:11 +08:00
[mock] Do not broadcast GroupEntranceAnnouncementChangeEvent because mirai-core does not do so.
This commit fixes 7908edb57b
This commit is contained in:
parent
bc6032f2e4
commit
479fa773f5
@ -21,7 +21,6 @@ import net.mamoe.mirai.contact.isOperator
|
||||
import net.mamoe.mirai.mock.contact.announcement.MockAnnouncements
|
||||
import net.mamoe.mirai.mock.contact.announcement.MockOnlineAnnouncement
|
||||
import net.mamoe.mirai.mock.contact.announcement.copy
|
||||
import net.mamoe.mirai.mock.utils.broadcastBlocking
|
||||
import net.mamoe.mirai.mock.utils.mock
|
||||
import net.mamoe.mirai.utils.ExternalResource
|
||||
import net.mamoe.mirai.utils.currentTimeSeconds
|
||||
@ -71,14 +70,6 @@ internal class MockAnnouncementsImpl(
|
||||
putDirect(ann)
|
||||
if (!events) return ann
|
||||
|
||||
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
||||
net.mamoe.mirai.event.events.GroupEntranceAnnouncementChangeEvent(
|
||||
origin = old?.content.orEmpty(),
|
||||
new = ann.content,
|
||||
group = group,
|
||||
operator = actor.takeUnless { it.id == group.bot.id }
|
||||
).broadcastBlocking()
|
||||
|
||||
// TODO: mirai-core no other events about announcements
|
||||
return ann
|
||||
}
|
||||
|
@ -100,9 +100,7 @@ internal class MockGroupTest : MockBotTestBase() {
|
||||
)
|
||||
)
|
||||
}.let { events ->
|
||||
assertEquals(2, events.size)
|
||||
@Suppress("RemoveRedundantQualifierName", "DEPRECATION")
|
||||
assertIsInstance<net.mamoe.mirai.event.events.GroupEntranceAnnouncementChangeEvent>(events[0])
|
||||
assertEquals(0, events.size)
|
||||
}
|
||||
val anc = group.announcements.asFlow().toList()
|
||||
assertEquals(1, anc.size)
|
||||
|
Loading…
Reference in New Issue
Block a user