mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-08 17:20:11 +08:00
Cleanup
This commit is contained in:
parent
038d69b7ac
commit
192594896e
@ -126,6 +126,9 @@ abstract class Bot : CoroutineScope {
|
||||
|
||||
// endregion
|
||||
|
||||
/**
|
||||
* 关闭这个 [Bot], 停止一切相关活动. 不可重新登录.
|
||||
*/
|
||||
abstract fun dispose(throwable: Throwable?)
|
||||
|
||||
// region extensions
|
||||
|
@ -11,7 +11,7 @@ import net.mamoe.mirai.data.Profile
|
||||
/**
|
||||
* QQ 对象.
|
||||
* 注意: 一个 [QQ] 实例并不是独立的, 它属于一个 [Bot].
|
||||
* 它不能被直接构造. 任何时候都应从 [Bot.qq], [Bot.ContactSystem.getQQ], [BotSession.qq] 或事件中获取.
|
||||
* 它不能被直接构造. 任何时候都应从 [Bot.getQQ] 或事件中获取.
|
||||
*
|
||||
* 对于同一个 [Bot] 任何一个人的 [QQ] 实例都是单一的.
|
||||
*
|
||||
|
@ -184,6 +184,7 @@ fun Any?.contentToString(prefix: String = ""): String = when (this) {
|
||||
|
||||
expect fun Any.contentToStringReflectively(prefix: String = ""): String
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun ByteReadPacket.readProtoMap(length: Long = this.remaining): ProtoMap {
|
||||
val map = ProtoMap(mutableMapOf())
|
||||
|
||||
@ -206,14 +207,8 @@ fun ByteReadPacket.readProtoMap(length: Long = this.remaining): ProtoMap {
|
||||
}
|
||||
|
||||
if (map.containsKey(id)) {
|
||||
if (map[id] is MutableList<*>) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
(map[id] as MutableList<Any>) += readValue()
|
||||
} else {
|
||||
map[id] = mutableListOf(map[id]!!)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
(map[id] as MutableList<Any>) += readValue()
|
||||
}
|
||||
if (map[id] !is MutableList<*>) map[id] = mutableListOf(map[id]!!)
|
||||
(map[id] as MutableList<Any>) += readValue()
|
||||
} else {
|
||||
map[id] = readValue()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user