diff --git a/mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/MiraiHttpAPIServer.kt b/mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/MiraiHttpAPIServer.kt index 2d4664b2f..651f3ada2 100644 --- a/mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/MiraiHttpAPIServer.kt +++ b/mirai-api-http/src/main/kotlin/net/mamoe/mirai/api/http/MiraiHttpAPIServer.kt @@ -18,16 +18,11 @@ object MiraiHttpAPIServer { @UseExperimental(KtorExperimentalAPI::class) fun start( port: Int = 8080, - authKey: String? = null, + authKey: String, callback: (() -> Unit)? = null ) { - authKey?.apply { - if (authKey.length in 8..128) { - SessionManager.authKey = authKey - } else { - logger.error("Expected authKey length is between 8 to 128") - } - } + require(authKey.length in 8..128) { "Expected authKey length is between 8 to 128" } + SessionManager.authKey = authKey // TODO: start是无阻塞的,理应获取启动状态后再执行后续代码 try { diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt index 6fca26a11..29fa98a9a 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/ContactImpl.kt @@ -1,6 +1,5 @@ package net.mamoe.mirai.qqandroid -import kotlinx.coroutines.async import kotlinx.coroutines.launch import net.mamoe.mirai.contact.* import net.mamoe.mirai.data.FriendNameRemark @@ -60,6 +59,9 @@ internal class QQImpl(bot: QQAndroidBot, override val coroutineContext: Coroutin TODO("not implemented") } + override fun equals(other: Any?): Boolean { + return other is QQ && other.id == this.id + } } @@ -108,6 +110,9 @@ internal class MemberImpl( return mute(0) } + override fun equals(other: Any?): Boolean { + return other is Member && other.id == this.id + } } @@ -325,4 +330,8 @@ internal class GroupImpl( } } } + + override fun equals(other: Any?): Boolean { + return other is Group && other.id == this.id + } } \ No newline at end of file