mirror of
https://github.com/mamoe/mirai.git
synced 2025-04-25 21:23:55 +08:00
Make OtherClientInfo.platform nullable.
This commit is contained in:
parent
c074bef9c6
commit
7f8003478c
mirai-core-api/src/commonMain/kotlin/contact
mirai-core/src/commonMain/kotlin
@ -19,7 +19,6 @@ import net.mamoe.mirai.message.data.Message
|
||||
import net.mamoe.mirai.utils.BotConfiguration.MiraiProtocol.ANDROID_PAD
|
||||
import net.mamoe.mirai.utils.BotConfiguration.MiraiProtocol.ANDROID_PHONE
|
||||
import net.mamoe.mirai.utils.ExternalResource
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalApi
|
||||
import net.mamoe.mirai.utils.MiraiInternalApi
|
||||
import net.mamoe.mirai.utils.toLongUnsigned
|
||||
|
||||
@ -50,7 +49,7 @@ public interface OtherClient : Contact {
|
||||
}
|
||||
}
|
||||
|
||||
public inline val OtherClient.platform: Platform get() = info.platform
|
||||
public inline val OtherClient.platform: Platform? get() = info.platform
|
||||
public inline val OtherClient.deviceName: String get() = info.deviceName
|
||||
public inline val OtherClient.deviceKind: String get() = info.deviceKind
|
||||
|
||||
@ -67,7 +66,7 @@ public data class OtherClientInfo @MiraiInternalApi constructor(
|
||||
/**
|
||||
* 登录平台
|
||||
*/
|
||||
public val platform: Platform,
|
||||
public val platform: Platform?,
|
||||
|
||||
/**
|
||||
* 示例:
|
||||
@ -98,9 +97,6 @@ public enum class Platform(
|
||||
IOS(3, 1),
|
||||
MOBILE(2, 2), // android
|
||||
WINDOWS(1, 3),
|
||||
|
||||
@MiraiExperimentalApi
|
||||
UNKNOWN(0, 0)
|
||||
;
|
||||
|
||||
public companion object {
|
||||
|
@ -221,7 +221,7 @@ internal open class MiraiImpl : IMirai, LowLevelApiAccessor {
|
||||
|
||||
fun SvcDevLoginInfo.toOtherClientInfo() = OtherClientInfo(
|
||||
iAppId.toInt(),
|
||||
Platform.getByTerminalId(iTerType?.toInt() ?: 0) ?: Platform.UNKNOWN,
|
||||
Platform.getByTerminalId(iTerType?.toInt() ?: 0),
|
||||
deviceName.orEmpty(),
|
||||
deviceTypeInfo.orEmpty()
|
||||
)
|
||||
|
@ -279,7 +279,7 @@ internal class QQAndroidBotNetworkHandler(coroutineContext: CoroutineContext, bo
|
||||
bot.otherClients.delegate.clear()
|
||||
bot.otherClients.delegate.addAll(list.map { bot.createOtherClient(it) })
|
||||
|
||||
bot.logger.info { "Online OtherClients: " + bot.otherClients.joinToString { "${it.deviceName}(${it.platform.name})" } }
|
||||
bot.logger.info { "Online OtherClients: " + bot.otherClients.joinToString { "${it.deviceName}(${it.platform?.name ?: "unknown platform"})" } }
|
||||
}
|
||||
|
||||
// caches
|
||||
|
Loading…
Reference in New Issue
Block a user