diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt index 49f3e1af3..baf377551 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/ExternalImage.kt @@ -39,23 +39,27 @@ class ExternalImage private constructor( val input: Any, // Input from kotlinx.io, InputStream from kotlinx.io MPP, ByteReadChannel from ktor val inputSize: Long // dont be greater than Int.MAX ) { + @Deprecated("changing soon in 1.0.0", level = DeprecationLevel.ERROR) constructor( md5: ByteArray, input: ByteReadChannel, inputSize: Long // dont be greater than Int.MAX ) : this(md5, input as Any, inputSize) + @Deprecated("changing soon in 1.0.0", level = DeprecationLevel.ERROR) constructor( md5: ByteArray, input: Input, inputSize: Long // dont be greater than Int.MAX ) : this(md5, input as Any, inputSize) + @Deprecated("changing soon in 1.0.0", level = DeprecationLevel.ERROR) constructor( md5: ByteArray, input: ByteReadPacket ) : this(md5, input as Any, input.remaining) + @Deprecated("changing soon in 1.0.0", level = DeprecationLevel.ERROR) @OptIn(InternalSerializationApi::class) constructor( md5: ByteArray, diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/ExternalImageJvm.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/ExternalImageJvm.kt index 3959f1e9c..fc13c18d5 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/ExternalImageJvm.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/ExternalImageJvm.kt @@ -62,6 +62,7 @@ fun BufferedImage.toExternalImage(formatName: String = "png"): ExternalImage { }) } + @Suppress("DEPRECATION_ERROR") return ExternalImage(digest.digest(), file.inputStream()) } @@ -73,6 +74,7 @@ suspend inline fun BufferedImage.suspendToExternalImage(): ExternalImage = withC @OptIn(MiraiInternalAPI::class) @Throws(IOException::class) fun File.toExternalImage(): ExternalImage { + @Suppress("DEPRECATION_ERROR") return ExternalImage( md5 = this.inputStream().md5(), // dont change input = this.inputStream()