mirror of
https://github.com/mamoe/mirai.git
synced 2025-04-25 21:23:55 +08:00
Review deprecation, remove 2.0-M2 migrations
This commit is contained in:
parent
499a518016
commit
8445048df4
mirai-core-api/src/commonMain/kotlin
@ -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.
|
||||
@ -12,7 +12,6 @@
|
||||
package net.mamoe.mirai
|
||||
|
||||
import net.mamoe.mirai.utils.BotConfiguration
|
||||
import net.mamoe.mirai.utils.PlannedRemoval
|
||||
|
||||
/**
|
||||
* 构造 [Bot] 的工厂. 这是 [Bot] 唯一的构造方式.
|
||||
@ -120,26 +119,4 @@ public interface BotFactory {
|
||||
return Mirai.BotFactory.newBot(qq, passwordMd5, configuration)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用指定的 [配置][configuration] 构造 [Bot] 实例
|
||||
*/
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "DeprecatedCallableAddReplaceWith")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution // resolves to member function
|
||||
@Deprecated("Prefer member function")
|
||||
@JvmSynthetic
|
||||
@PlannedRemoval("2.0-RC")
|
||||
public inline fun BotFactory.newBot(qq: Long, password: String, configuration: (BotConfiguration.() -> Unit)): Bot =
|
||||
this.newBot(qq, password, BotConfiguration().apply(configuration))
|
||||
|
||||
/**
|
||||
* 使用指定的 [配置][configuration] 构造 [Bot] 实例
|
||||
*/
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "DeprecatedCallableAddReplaceWith")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution // resolves to member function
|
||||
@Deprecated("Prefer member function")
|
||||
@JvmSynthetic
|
||||
@PlannedRemoval("2.0-RC")
|
||||
public inline fun BotFactory.newBot(qq: Long, password: ByteArray, configuration: (BotConfiguration.() -> Unit)): Bot =
|
||||
this.newBot(qq, password, BotConfiguration().apply(configuration))
|
||||
}
|
@ -14,7 +14,6 @@
|
||||
package net.mamoe.mirai.event
|
||||
|
||||
import kotlinx.coroutines.*
|
||||
import net.mamoe.mirai.utils.PlannedRemoval
|
||||
import net.mamoe.mirai.utils.castOrNull
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
@ -164,7 +163,7 @@ public annotation class EventHandler(
|
||||
)
|
||||
|
||||
/**
|
||||
* 实现这个接口的对象可以通过 [EventHandler] 标注事件监听函数, 并通过 [registerEvents] 注册.
|
||||
* 实现这个接口的对象可以通过 [EventHandler] 标注事件监听函数, 并通过 [registerTo] 注册.
|
||||
*
|
||||
* @see SimpleListenerHost 简单的实现
|
||||
* @see EventHandler 查看更多信息
|
||||
@ -248,34 +247,4 @@ public class ExceptionInEventHandlerException(
|
||||
@JvmSynthetic
|
||||
// T 通常可以是 SimpleListenerHost
|
||||
public inline fun <T> T.registerTo(eventChannel: EventChannel<*>): Unit
|
||||
where T : CoroutineScope, T : ListenerHost = eventChannel.parentScope(this).registerListenerHost(this)
|
||||
|
||||
|
||||
@Deprecated(
|
||||
"Use EventChannel.registerListenerHost",
|
||||
ReplaceWith(
|
||||
"this.globalEventChannel(coroutineContext).registerListenerHost(this)",
|
||||
"net.mamoe.mirai.event.*"
|
||||
),
|
||||
DeprecationLevel.ERROR
|
||||
)
|
||||
@PlannedRemoval("2.0-RC")
|
||||
@JvmOverloads
|
||||
public fun <T> T.registerEvents(coroutineContext: CoroutineContext = EmptyCoroutineContext): Unit
|
||||
where T : CoroutineScope, T : ListenerHost =
|
||||
this.globalEventChannel(coroutineContext).registerListenerHost(this)
|
||||
|
||||
@Deprecated(
|
||||
"Use EventChannel.registerListenerHost",
|
||||
ReplaceWith(
|
||||
"this.globalEventChannel(coroutineContext).registerListenerHost(host)",
|
||||
"net.mamoe.mirai.event.*"
|
||||
),
|
||||
DeprecationLevel.ERROR
|
||||
)
|
||||
@PlannedRemoval("2.0-RC")
|
||||
@JvmOverloads
|
||||
public fun CoroutineScope.registerEvents(
|
||||
host: ListenerHost,
|
||||
coroutineContext: CoroutineContext = EmptyCoroutineContext
|
||||
): Unit = globalEventChannel(coroutineContext).registerListenerHost(host)
|
||||
where T : CoroutineScope, T : ListenerHost = eventChannel.parentScope(this).registerListenerHost(this)
|
@ -61,47 +61,22 @@ public data class PokeMessage @MiraiInternalApi constructor(
|
||||
@JvmField
|
||||
public val ChuoYiChuo: PokeMessage = PokeMessage("戳一戳", 1, -1)
|
||||
|
||||
/** 戳一戳 */
|
||||
@JvmField
|
||||
@Deprecated("Use ChuoYiChuo", replaceWith = ReplaceWith("ChuoYiChuo"))
|
||||
public val Poke: PokeMessage = ChuoYiChuo
|
||||
|
||||
/** 比心 */
|
||||
@JvmField
|
||||
public val BiXin: PokeMessage = PokeMessage("比心", 2, -1)
|
||||
|
||||
/** 比心 */
|
||||
@JvmField
|
||||
@Deprecated("Use BiXin", replaceWith = ReplaceWith("BiXin"))
|
||||
public val ShowLove: PokeMessage = BiXin
|
||||
|
||||
/** 点赞 */
|
||||
@JvmField
|
||||
public val DianZan: PokeMessage = PokeMessage("点赞", 3, -1)
|
||||
|
||||
/** 点赞 */
|
||||
@JvmField
|
||||
@Deprecated("Use DianZan", replaceWith = ReplaceWith("DianZan"))
|
||||
public val Like: PokeMessage = DianZan
|
||||
|
||||
/** 心碎 */
|
||||
@JvmField
|
||||
public val XinSui: PokeMessage = PokeMessage("心碎", 4, -1)
|
||||
|
||||
/** 心碎 */
|
||||
@JvmField
|
||||
@Deprecated("Use XinSui", replaceWith = ReplaceWith("XinSui"))
|
||||
public val Heartbroken: PokeMessage = XinSui
|
||||
|
||||
/** 666 */
|
||||
@JvmField
|
||||
public val LiuLiuLiu: PokeMessage = PokeMessage("666", 5, -1)
|
||||
|
||||
/** 666 */
|
||||
@JvmField
|
||||
@Deprecated("Use LiuLiuLiu", replaceWith = ReplaceWith("LiuLiuLiu"))
|
||||
public val SixSixSix: PokeMessage = LiuLiuLiu
|
||||
|
||||
/** 放大招 */
|
||||
@JvmField
|
||||
public val FangDaZhao: PokeMessage = PokeMessage("放大招", 6, -1)
|
||||
|
@ -30,6 +30,7 @@ import kotlin.js.JsName
|
||||
ReplaceWith("this is PlainText", "net.mamoe.mirai.message.data.PlainText"),
|
||||
ERROR
|
||||
)
|
||||
@PlannedRemoval("2.0.0")
|
||||
public inline fun Message.isPlain(): Boolean {
|
||||
contract {
|
||||
returns(true) implies (this@isPlain is PlainText)
|
||||
@ -46,6 +47,7 @@ public inline fun Message.isPlain(): Boolean {
|
||||
ReplaceWith("this is PlainText", "net.mamoe.mirai.message.data.PlainText"),
|
||||
ERROR
|
||||
)
|
||||
@PlannedRemoval("2.0.0")
|
||||
public inline fun Message.isNotPlain(): Boolean {
|
||||
contract {
|
||||
returns(false) implies (this@isNotPlain is PlainText)
|
||||
@ -59,6 +61,7 @@ public inline fun Message.isNotPlain(): Boolean {
|
||||
ReplaceWith("!this.isContentEmpty()", "net.mamoe.mirai.message.data.isContentNotEmpty"),
|
||||
ERROR
|
||||
)
|
||||
@PlannedRemoval("2.0.0")
|
||||
public inline fun Message.isContentNotEmpty(): Boolean = !this.isContentEmpty()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user