Add equals

This commit is contained in:
Him188 2020-02-05 09:03:10 +08:00
parent 22f2c5087e
commit 69f1ee2cf2
2 changed files with 13 additions and 9 deletions

View File

@ -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 {

View File

@ -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
}
}