From d93b55f57ab5ffa34e47c7fc5cec173c1bb42162 Mon Sep 17 00:00:00 2001 From: cssxsh Date: Wed, 26 Jul 2023 16:27:59 +0800 Subject: [PATCH] [console] Add `AutoLoginEvent.toString()` (#2750) * feat: AutoLoginEvent.toString * add: api dump * fix: AutoLoginEvent.toString * fix: cause info --- .../compatibility-validation/jvm/api/jvm.api | 2 ++ .../mirai-console/src/events/AutoLoginEvent.kt | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mirai-console/backend/mirai-console/compatibility-validation/jvm/api/jvm.api b/mirai-console/backend/mirai-console/compatibility-validation/jvm/api/jvm.api index c5811adb0..8561def1f 100644 --- a/mirai-console/backend/mirai-console/compatibility-validation/jvm/api/jvm.api +++ b/mirai-console/backend/mirai-console/compatibility-validation/jvm/api/jvm.api @@ -1316,10 +1316,12 @@ public abstract class net/mamoe/mirai/console/events/AutoLoginEvent : net/mamoe/ public final class net/mamoe/mirai/console/events/AutoLoginEvent$Failure : net/mamoe/mirai/console/events/AutoLoginEvent { public fun getBot ()Lnet/mamoe/mirai/Bot; public final fun getCause ()Ljava/lang/Throwable; + public fun toString ()Ljava/lang/String; } public final class net/mamoe/mirai/console/events/AutoLoginEvent$Success : net/mamoe/mirai/console/events/AutoLoginEvent { public fun getBot ()Lnet/mamoe/mirai/Bot; + public fun toString ()Ljava/lang/String; } public abstract interface class net/mamoe/mirai/console/events/ConsoleEvent : net/mamoe/mirai/event/Event { diff --git a/mirai-console/backend/mirai-console/src/events/AutoLoginEvent.kt b/mirai-console/backend/mirai-console/src/events/AutoLoginEvent.kt index 138eaf8a2..4e7325736 100644 --- a/mirai-console/backend/mirai-console/src/events/AutoLoginEvent.kt +++ b/mirai-console/backend/mirai-console/src/events/AutoLoginEvent.kt @@ -27,7 +27,11 @@ public sealed class AutoLoginEvent : BotEvent, ConsoleEvent, AbstractEvent() { */ public class Success @MiraiInternalApi constructor( override val bot: Bot - ) : AutoLoginEvent() + ) : AutoLoginEvent() { + override fun toString(): String { + return "AutoLoginEvent.Success(bot=${bot.id}, protocol=${bot.configuration.protocol}, heartbeatStrategy=${bot.configuration.heartbeatStrategy})" + } + } /** * 登录失败 @@ -35,5 +39,9 @@ public sealed class AutoLoginEvent : BotEvent, ConsoleEvent, AbstractEvent() { public class Failure @MiraiInternalApi constructor( override val bot: Bot, public val cause: Throwable - ) : AutoLoginEvent() + ) : AutoLoginEvent() { + override fun toString(): String { + return "AutoLoginEvent.Failure(bot=${bot.id}, protocol=${bot.configuration.protocol}, cause=${cause})" + } + } } \ No newline at end of file