mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-09 18:46:58 +08:00
78d0b4fd54
* [core] process `wtlogin.trans_emp` to support qrcode login
* [core] fix `wtlogin.trans_emp` protocol
* [core] optimize QRCodeLoginProcessor logic
* [core] fix `wtlogin.trans_emp` outgoing packet
* [core] cancel login when logging a bot which is inconsistent from bot factory
* [core] ignore `flag3` check on ANDROID_WATCH & name `flag1` and `flag2`
* [core] provide default `QRCodeLoginListener` for jvm
* [core] don't catch IllegalStateException in QRCodeLoginProcessor
* [core] Use `LoginSolver.createQRCodeLoginListener()` instead of property; Rename configuration name
* [core] Code improvement
* [core] remove qrcode state lock
* [core] ignore `flag3` when command is `wtlogin.trans_emp` in packet codec
* [core] enable qrcode login for macos
* [core] remove debug property in log
* [core] reformat code
* [core] rename `TransEmpResponse` to `Response`
* [core] assert `flag3Exception` not null first
* [core] remove arg client
* [core] update qrcode login notes
* [core] set custom qrcode size
* [core] Draft BotAuthorization
* [core] make SecretsProtection mpp
* [core] BotAuthorization.byXXX
* [core] Move QRCodeLoginListener to `.auth`
* [core] Protect data of BotAccount
* [core] Add SelectorRequireReconnectException
* [core] Implementation of BotAuthorization
* Revert changes of BotConfiguration
* api dump
* [core] remove passwordMd5 in `BotAccount`
* [mock] Add new bot factory function to mock bot factory
* Delete LoginCommandTest
* [core] Improve QRCode render
* [core] Introduce UnsupportedCaptchaMethodException & UnsupportedQRCodeCaptchaException
* api dump
* update docs
* [core] update `DebugRunHelper`
* [core] add simple block for BotAuthorization
* api dump
* Rename `canDoQRLogin` to `supportsQRLogin`, and specify argument names for MiraiProtocolInternal
* Remove `phoneNumber` parameter from BotAccount
* Make `BotAccount.<init>` with String password parameter TestOnly
* Rename `InconsistentBotException` to `InconsistentBotIdException`
* Rename `QRCodeLoginListener.onStatusChanged` to `QRCodeLoginListener.onStateChanged`
* Rename `BotAuthorizationResult` to `BotAuthResult`
* Rename BotAuthComponent, move internal APIs to internal module
* Logic fixup
* doc update
* QRCodeLoginListener.qrCodeStateUpdateInterval & onIntervalLoop
* console login with BotAuthorization
* update testing
* Update mirai-core-api/src/jvmMain/kotlin/utils/LoginSolver.jvm.kt
* Move AuthControl outside SsoProcessor
* Redesign auth
* Add initialTicket to producerCoroutine
* Revert protocol changes of MACOS
* Fix latch death locking
* Fix CoroutineOnDemandValueScope.receiveOrNull exceptional finish
* Fix exception collecting
* Fix DefaultBotAuthorizationFactory loading
* [core] qrcode login for IPAD protocol
* Revert "[core] qrcode login for IPAD protocol"
This reverts commit
|
||
---|---|---|
.. | ||
compatibility-validation | ||
src | ||
build.gradle.kts | ||
README.md |
mirai-core-api
mirai 核心 API 模块。本文档帮助读者了解该模块的主要架构。
mirai 为多平台设计。支持 Android 和 JVM 双平台,拥有多个源集。
commonMain
:平台无关的通用代码。绝大部分代码都存在与这个源集。jvmMain
:桌面 JVM 平台的特别实现。androidMain
:Android 平台的特别实现。阅读源码通常阅读
src/commonMain
架构
包名 | 描述 |
---|---|
net.mamoe.mirai |
mirai 核心 API |
.contact |
联系人类型。如群 Group ,好友 Friend |
.event |
事件框架。提供事件对象的基类以及监听事件的方法 |
.event.events |
事件的定义。包含许多事件的具体类, 如消息事件 MessageEvent |
.message |
消息系统 |
.message.data |
提供对富文本聊天消息及其元素多样性的抽象 |
.message.code |
提供一个易于阅读的消息字符串表示方式 |
.message.action |
提供与消息有关的动作的抽象,如戳一戳 |
.utils |
一些工具类 |
.internal |
内部实现 |
.internal.event |
事件框架的实现 |
net.mamoe.mirai
IMirai
API 模块与协议实现模块的对接接口。
- 单例
- 通过
ServiceLoader
寻找协议实现。 - 若
ServiceLoader
在特定环境下不可用,外部可在 Kotlin 在调用任何 Mirai API 之前覆盖实例:@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") // 必要 net.mamoe.mirai._MiraiInstance.set(net.mamoe.mirai.internal.MiraiImpl())
Bot
表示一个机器人对象(账户)。
- 通过 BotFactory 构造
- 是功能的入口点----大部分操作都直接或间接经过
Bot
- 持有联系人(好友和群)对象列表
- 可获得事件通道
net.mamoe.mirai.contact
联系人系统。docs/Contacts
net.mamoe.mirai.event
事件系统。docs/Contacts
net.mamoe.mirai.event.events
事件列表。README
net.mamoe.mirai.message
消息系统。
MessageReceipt
在发送消息(Contact.sendMessage
)后收到的回执。
MessageSerializers
kotlinx.serialization 序列化支持。
net.mamoe.mirai.message.data
对富文本聊天消息及其元素多样性的抽象。
一个消息元素最基本的接口为 Message.