mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-08 17:20:11 +08:00
Add shortcuts for creating BotAccount and Bot
This commit is contained in:
parent
6817d8b94c
commit
e42f925b2c
@ -21,9 +21,12 @@ import kotlin.coroutines.CoroutineContext
|
||||
import kotlin.coroutines.coroutineContext
|
||||
import kotlin.jvm.JvmOverloads
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE", "FunctionName")
|
||||
inline fun BotAccount(id: Long, password: String): BotAccount = BotAccount(id.toUInt(), password)
|
||||
|
||||
data class BotAccount(
|
||||
val id: UInt,
|
||||
val password: String//todo 不保存 password?
|
||||
val password: String
|
||||
)
|
||||
|
||||
@Suppress("FunctionName")
|
||||
@ -35,6 +38,9 @@ suspend inline fun Bot(account: BotAccount): Bot = Bot(account, coroutineContext
|
||||
@Suppress("FunctionName")
|
||||
suspend inline fun Bot(qq: UInt, password: String): Bot = Bot(qq, password, coroutineContext)
|
||||
|
||||
@Suppress("FunctionName")
|
||||
suspend inline fun Bot(qq: Long, password: String): Bot = Bot(qq.toUInt(), password, coroutineContext)
|
||||
|
||||
/**
|
||||
* Mirai 的机器人. 一个机器人实例登录一个 QQ 账号.
|
||||
* Mirai 为多账号设计, 可同时维护多个机器人.
|
||||
|
Loading…
Reference in New Issue
Block a user