Commit 98de5893 authored by Him188's avatar Him188

Add @JvmStatic and @JvmOverloads

parent dd9e59aa
......@@ -27,6 +27,7 @@ import net.mamoe.mirai.network.BotNetworkHandler
import net.mamoe.mirai.network.LoginFailedException
import net.mamoe.mirai.utils.*
import net.mamoe.mirai.utils.io.transferTo
import kotlin.jvm.JvmStatic
/**
* 机器人对象. 一个机器人实例登录一个 QQ 账号.
......@@ -42,6 +43,7 @@ abstract class Bot : CoroutineScope {
/**
* 复制一份此时的 [Bot] 实例列表.
*/
@JvmStatic
val instances: List<WeakRef<Bot>> get() = BotImpl.instances.toList()
/**
......@@ -52,6 +54,7 @@ abstract class Bot : CoroutineScope {
/**
* 获取一个 [Bot] 实例, 找不到则 [NoSuchElementException]
*/
@JvmStatic
fun instanceWhose(qq: Long): Bot = BotImpl.instanceWhose(qq = qq)
}
......
......@@ -44,6 +44,7 @@ internal val factory: BotFactory = run {
/**
* 加载现有协议的 [BotFactory], 并使用指定的 [配置][configuration] 构造 [Bot] 实例
*/
@JvmOverloads
fun Bot(context: Context, qq: Long, password: String, configuration: BotConfiguration = BotConfiguration.Default): Bot =
factory.Bot(context, qq, password, configuration)
......@@ -57,6 +58,7 @@ inline fun Bot(context: Context, qq: Long, password: String, configuration: (Bot
/**
* 加载现有协议的 [BotFactory], 并使用指定的 [配置][configuration] 构造 [Bot] 实例
*/
@JvmOverloads
fun Bot(qq: Long, password: String, configuration: BotConfiguration = BotConfiguration.Default): Bot =
factory.Bot(ContextImpl(), qq, password, configuration)
......
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