Commit 331d9d5e authored by Him188's avatar Him188

Fix incompatible `Bot.instances`

parent 70f421ae
...@@ -55,8 +55,17 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI( ...@@ -55,8 +55,17 @@ abstract class Bot : CoroutineScope, LowLevelBotAPIAccessor, BotJavaFriendlyAPI(
/** /**
* 复制一份此时的 [Bot] 实例列表. * 复制一份此时的 [Bot] 实例列表.
*/ */
@Deprecated("use botInstances instead", replaceWith = ReplaceWith("botInstances"))
@JvmStatic @JvmStatic
val instances: List<Bot> val instances: List<WeakRef<Bot>>
get() = BotImpl.instances.toList()
/**
* 复制一份此时的 [Bot] 实例列表.
*/
@SinceMirai("0.39.1")
@JvmStatic
val botInstances: List<Bot>
get() = BotImpl.instances.asSequence().mapNotNull { it.get() }.toList() get() = BotImpl.instances.asSequence().mapNotNull { it.get() }.toList()
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment