Browse Source

Deprecate openChannel

Him188 5 years ago
parent
commit
7f347feedd

+ 3 - 0
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/QQAndroidBot.common.kt

@@ -651,6 +651,9 @@ internal abstract class QQAndroidBotBase constructor(
         else -> error("unsupported image class: ${image::class.simpleName}")
     }
 
+    @Suppress("DeprecatedCallableAddReplaceWith")
+    @PlannedRemoval("1.0.0")
+    @Deprecated("use your own Http clients, this is going to be removed in 1.0.0", level = DeprecationLevel.WARNING)
     override suspend fun openChannel(image: Image): ByteReadChannel {
         return MiraiPlatformUtils.Http.get<HttpResponse>(queryImageUrl(image)).content.toKotlinByteReadChannel()
     }

+ 3 - 0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt

@@ -177,6 +177,9 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(
      * @see ByteReadChannel.copyAndClose
      * @see ByteReadChannel.copyTo
      */
+    @PlannedRemoval("1.0.0")
+    @Deprecated("use your own Http clients, this is going to be removed in 1.0.0", level = DeprecationLevel.WARNING)
+    @MiraiExperimentalAPI
     @JvmSynthetic
     abstract suspend fun openChannel(image: Image): ByteReadChannel
 

+ 3 - 0
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/MessagePacket.kt

@@ -195,6 +195,9 @@ abstract class MessagePacketBase<out TSender : QQ, out TSubject : Contact> : Pac
      * @see ByteReadChannel.copyAndClose
      * @see ByteReadChannel.copyTo
      */
+    @Suppress("DeprecatedCallableAddReplaceWith", "DEPRECATION")
+    @PlannedRemoval("1.0.0")
+    @Deprecated("use your own Http clients, this is going to be removed in 1.0.0", level = DeprecationLevel.WARNING)
     suspend inline fun Image.channel(): ByteReadChannel = bot.openChannel(this)
     // endregion