|
|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * Copyright 2019-2020 Mamoe Technologies and contributors.
|
|
|
+ * Copyright 2019-2021 Mamoe Technologies and contributors.
|
|
|
*
|
|
|
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
|
|
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
|
|
@@ -21,6 +21,7 @@ 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
|
|
|
|
|
|
/**
|
|
|
* 其他设备. 如当 [Bot] 以 [ANDROID_PHONE] 登录时, 还可以有其他设备以 [ANDROID_PAD], iOS, PC 或其他设备登录.
|
|
|
@@ -34,9 +35,11 @@ public interface OtherClient : Contact {
|
|
|
public override val bot: Bot
|
|
|
|
|
|
/**
|
|
|
- * 与 [Bot.id] 相同
|
|
|
+ * 识别 id, 仅运行时使用.
|
|
|
+ *
|
|
|
+ * 此 id 由其他客户端控制, 重启可能会变化.
|
|
|
*/
|
|
|
- public override val id: Long get() = bot.id
|
|
|
+ public override val id: Long get() = info.appId.toLongUnsigned()
|
|
|
|
|
|
override suspend fun sendMessage(message: Message): MessageReceipt<OtherClient> {
|
|
|
throw UnsupportedOperationException("OtherClientImpl.sendMessage is not yet supported.")
|
|
|
@@ -47,14 +50,10 @@ public interface OtherClient : Contact {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-@MiraiInternalApi
|
|
|
-public inline val OtherClient.appId: Int
|
|
|
- get() = info.appId
|
|
|
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
|
|
|
|
|
|
-@MiraiExperimentalApi
|
|
|
public data class OtherClientInfo @MiraiInternalApi constructor(
|
|
|
|
|
|
/**
|
|
|
@@ -62,6 +61,7 @@ public data class OtherClientInfo @MiraiInternalApi constructor(
|
|
|
*
|
|
|
* 不可能有 [appId] 相同的两个客户端t在线.
|
|
|
*/
|
|
|
+ @MiraiInternalApi
|
|
|
public val appId: Int,
|
|
|
|
|
|
/**
|
|
|
@@ -99,6 +99,7 @@ public enum class Platform(
|
|
|
MOBILE(2, 2), // android
|
|
|
WINDOWS(1, 3),
|
|
|
|
|
|
+ @MiraiExperimentalApi
|
|
|
UNKNOWN(0, 0)
|
|
|
;
|
|
|
|