-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[console] Add StartupEvent and AutoLoginEvent (#2446)
* add: console event impl * add: internal annotation * add: since 2.15
- Loading branch information
Showing
4 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
mirai-console/backend/mirai-console/src/events/AutoLoginEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2019-2023 Mamoe Technologies and contributors. | ||
* | ||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. | ||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. | ||
* | ||
* https://github.com/mamoe/mirai/blob/dev/LICENSE | ||
*/ | ||
|
||
package net.mamoe.mirai.console.events | ||
|
||
import net.mamoe.mirai.Bot | ||
import net.mamoe.mirai.event.AbstractEvent | ||
import net.mamoe.mirai.console.internal.* | ||
import net.mamoe.mirai.event.events.BotEvent | ||
import net.mamoe.mirai.utils.MiraiInternalApi | ||
|
||
/** | ||
* 自动登录执行后广播的事件 | ||
* @property bot 登录的BOT | ||
* @see MiraiConsoleImplementationBridge.doStart | ||
* @since 2.15 | ||
*/ | ||
public sealed class AutoLoginEvent : BotEvent, ConsoleEvent, AbstractEvent() { | ||
/** | ||
* 登录成功 | ||
*/ | ||
public class Success @MiraiInternalApi constructor( | ||
override val bot: Bot | ||
) : AutoLoginEvent() | ||
|
||
/** | ||
* 登录失败 | ||
*/ | ||
public class Failure @MiraiInternalApi constructor( | ||
override val bot: Bot, | ||
public val cause: Throwable | ||
) : AutoLoginEvent() | ||
} |
26 changes: 26 additions & 0 deletions
26
mirai-console/backend/mirai-console/src/events/StartupEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright 2019-2023 Mamoe Technologies and contributors. | ||
* | ||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. | ||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. | ||
* | ||
* https://github.com/mamoe/mirai/blob/dev/LICENSE | ||
*/ | ||
|
||
package net.mamoe.mirai.console.events | ||
|
||
import net.mamoe.mirai.console.extensions.PostStartupExtension | ||
import net.mamoe.mirai.event.AbstractEvent | ||
import net.mamoe.mirai.console.internal.* | ||
import net.mamoe.mirai.utils.MiraiInternalApi | ||
|
||
/** | ||
* 在 Console 启动完成后广播的事件 | ||
* @property timestamp 启动完成的时间戳 | ||
* @see MiraiConsoleImplementationBridge.doStart | ||
* @see PostStartupExtension | ||
* @since 2.15 | ||
*/ | ||
public class StartupEvent @MiraiInternalApi constructor( | ||
public val timestamp: Long | ||
) : ConsoleEvent, AbstractEvent() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters