1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-04-24 20:43:33 +08:00

Add isOnline

This commit is contained in:
Him188 2020-01-30 20:22:13 +08:00
parent d6d1f2c74d
commit cc853ce078
2 changed files with 11 additions and 2 deletions
mirai-core/src/commonMain/kotlin/net.mamoe.mirai

View File

@ -98,7 +98,11 @@ abstract class BotImpl<N : BotNetworkHandler> constructor(
}
_network = createNetworkHandler(this.coroutineContext)
_network.login()
while (true){
_network.login()
delay(3000)
logger.warning("Login failed. Retrying in 3s...")
}
}
protected abstract fun createNetworkHandler(coroutineContext: CoroutineContext): N

View File

@ -21,10 +21,15 @@ import net.mamoe.mirai.data.Profile
* @author Him188moe
*/
interface QQ : Contact, CoroutineScope {
/**
* 是否在线. 这个属性的值将会与服务器同步更新.
*/
val isOnline: Boolean
/**
* 请求头像下载链接
*/
// @MiraiExperimentalAPI
// @MiraiExperimentalAPI
//suspend fun queryAvatar(): AvatarLink
/**