From 479fa773f586afec468f348a7fd70e6fb2ea0c8f Mon Sep 17 00:00:00 2001 From: Him188 Date: Tue, 27 Dec 2022 17:50:06 +0000 Subject: [PATCH] [mock] Do not broadcast GroupEntranceAnnouncementChangeEvent because mirai-core does not do so. This commit fixes 7908edb57bbdbea59c2c183e963df9bdc2ebae23 --- .../src/internal/contact/MockAnnouncementsImpl.kt | 9 --------- mirai-core-mock/test/mock/MockGroupTest.kt | 4 +--- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/mirai-core-mock/src/internal/contact/MockAnnouncementsImpl.kt b/mirai-core-mock/src/internal/contact/MockAnnouncementsImpl.kt index a5e50b7f2..831eb5c3d 100644 --- a/mirai-core-mock/src/internal/contact/MockAnnouncementsImpl.kt +++ b/mirai-core-mock/src/internal/contact/MockAnnouncementsImpl.kt @@ -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 } diff --git a/mirai-core-mock/test/mock/MockGroupTest.kt b/mirai-core-mock/test/mock/MockGroupTest.kt index feee4dd2f..485068a98 100644 --- a/mirai-core-mock/test/mock/MockGroupTest.kt +++ b/mirai-core-mock/test/mock/MockGroupTest.kt @@ -100,9 +100,7 @@ internal class MockGroupTest : MockBotTestBase() { ) ) }.let { events -> - assertEquals(2, events.size) - @Suppress("RemoveRedundantQualifierName", "DEPRECATION") - assertIsInstance(events[0]) + assertEquals(0, events.size) } val anc = group.announcements.asFlow().toList() assertEquals(1, anc.size)