From 98b0073f81b66f8361adb5416414a01adaf5818d Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 14 Feb 2020 18:20:31 +0800 Subject: [PATCH] Add `BotOfflineEvent.Dropped` and `BotReloginEvent` --- .../net.mamoe.mirai/event/events/BotEvents.kt | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt index 75aee9c06..9047df8e0 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/events/BotEvents.kt @@ -42,19 +42,32 @@ data class BotOnlineEvent(override val bot: Bot) : BotActiveEvent /** * [Bot] 离线. */ -sealed class BotOfflineEvent : BotActiveEvent { +sealed class BotOfflineEvent : BotEvent { /** * 主动离线 */ - data class Active(override val bot: Bot, val cause: Throwable?) : BotOfflineEvent() + data class Active(override val bot: Bot, val cause: Throwable?) : BotOfflineEvent(), BotActiveEvent /** * 被挤下线 */ - data class Force(override val bot: Bot, val title: String, val message: String) : BotOfflineEvent(), Packet + data class Force(override val bot: Bot, val title: String, val message: String) : BotOfflineEvent(), Packet, BotPassiveEvent + + /** + * 被服务器断开或因网络问题而掉线 + */ + data class Dropped(override val bot: Bot) : BotOfflineEvent(), Packet, BotPassiveEvent } +/** + * [Bot] 主动重新登录. + */ +data class BotReloginEvent( + override val bot: Bot, + val cause: Throwable? +) : BotEvent, BotActiveEvent + // endregion // region 消息