Deprecate openChannel

This commit is contained in:
Him188 2020-04-17 21:36:39 +08:00
parent fa211cab5c
commit 7f347feedd
3 changed files with 9 additions and 0 deletions

View File

@ -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()
}

View File

@ -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

View File

@ -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