Commit eaf3782b authored by Him188's avatar Him188

Add getGroupByUinOrNull (internal)

parent 32b526b0
...@@ -38,7 +38,12 @@ internal abstract class QQAndroidBotBase constructor( ...@@ -38,7 +38,12 @@ internal abstract class QQAndroidBotBase constructor(
configuration: BotConfiguration configuration: BotConfiguration
) : BotImpl<QQAndroidBotNetworkHandler>(account, configuration) { ) : BotImpl<QQAndroidBotNetworkHandler>(account, configuration) {
val client: QQAndroidClient = val client: QQAndroidClient =
QQAndroidClient(context, account, bot = @Suppress("LeakingThis") this as QQAndroidBot, device = configuration.deviceInfo?.invoke(context) ?: SystemDeviceInfo(context)) QQAndroidClient(
context,
account,
bot = @Suppress("LeakingThis") this as QQAndroidBot,
device = configuration.deviceInfo?.invoke(context) ?: SystemDeviceInfo(context)
)
internal var firstLoginSucceed: Boolean = false internal var firstLoginSucceed: Boolean = false
override val uin: Long get() = client.uin override val uin: Long get() = client.uin
override val qqs: ContactList<QQ> = ContactList(LockFreeLinkedList()) override val qqs: ContactList<QQ> = ContactList(LockFreeLinkedList())
...@@ -60,6 +65,11 @@ internal abstract class QQAndroidBotBase constructor( ...@@ -60,6 +65,11 @@ internal abstract class QQAndroidBotBase constructor(
return groups.delegate.filteringGetOrNull { (it as GroupImpl).uin == uin } ?: throw NoSuchElementException("Can not found group with ID=${uin}") return groups.delegate.filteringGetOrNull { (it as GroupImpl).uin == uin } ?: throw NoSuchElementException("Can not found group with ID=${uin}")
} }
fun getGroupByUinOrNull(uin: Long): Group? {
return groups.delegate.filteringGetOrNull { (it as GroupImpl).uin == uin }
}
override fun onEvent(event: BotEvent): Boolean { override fun onEvent(event: BotEvent): Boolean {
return firstLoginSucceed return firstLoginSucceed
} }
......
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