[mock] Do not broadcast GroupEntranceAnnouncementChangeEvent because mirai-core does not do so.

This commit fixes 7908edb57b
This commit is contained in:
Him188 2022-12-27 17:50:06 +00:00
parent bc6032f2e4
commit 479fa773f5
No known key found for this signature in database
GPG Key ID: BA439CDDCF652375
2 changed files with 1 additions and 12 deletions

View File

@ -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
}

View File

@ -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)