Throw UnsupportedOperationException for OtherClient.sendMessage and OtherClient.uploadImage

This commit is contained in:
Him188 2020-12-24 11:48:09 +08:00
parent 7015501f53
commit 15ee2303c2
2 changed files with 15 additions and 4 deletions

View File

@ -12,8 +12,12 @@
package net.mamoe.mirai.contact
import net.mamoe.mirai.Bot
import net.mamoe.mirai.message.MessageReceipt
import net.mamoe.mirai.message.data.Image
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.ExternalImage
/**
* 其他设备. 如当 [Bot] [ANDROID_PHONE] 登录时, 还可以有其他设备以 [ANDROID_PAD], iOS, PC 或其他设备登录.
@ -33,6 +37,14 @@ public interface OtherClient : Contact {
* [Bot.id] 相同
*/
public override val id: Long get() = bot.id
override suspend fun sendMessage(message: Message): MessageReceipt<OtherClient> {
throw UnsupportedOperationException("OtherClientImpl.sendMessage is not yet supported.")
}
override suspend fun uploadImage(image: ExternalImage): Image {
throw UnsupportedOperationException("OtherClientImpl.uploadImage is not yet supported.")
}
}
/**

View File

@ -11,7 +11,6 @@ package net.mamoe.mirai.internal.contact
import net.mamoe.mirai.Bot
import net.mamoe.mirai.contact.ClientKind
import net.mamoe.mirai.contact.Contact
import net.mamoe.mirai.contact.OtherClient
import net.mamoe.mirai.message.MessageReceipt
import net.mamoe.mirai.message.data.Image
@ -29,12 +28,12 @@ internal class OtherClientImpl(
override val kind: ClientKind,
val instanceInfo: InstanceInfo
) : OtherClient, AbstractContact(bot, coroutineContext) {
override suspend fun sendMessage(message: Message): MessageReceipt<Contact> {
TODO("Not yet implemented")
override suspend fun sendMessage(message: Message): MessageReceipt<OtherClient> {
throw UnsupportedOperationException("OtherClientImpl.sendMessage is not yet supported.")
}
override suspend fun uploadImage(image: ExternalImage): Image {
TODO("Not yet implemented")
throw UnsupportedOperationException("OtherClientImpl.uploadImage is not yet supported.")
}
override fun toString(): String {