1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-04-09 02:10:10 +08:00

Review: misc improvements

This commit is contained in:
Him188 2020-02-26 12:54:06 +08:00
parent 48a2d9caff
commit be63ec48fa
3 changed files with 11 additions and 7 deletions
build.gradle
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/contact

View File

@ -1,18 +1,18 @@
buildscript {
repositories {
mavenLocal()
maven { url "https://mirrors.huaweicloud.com/repository/maven" }
maven { url 'https://mirrors.huaweicloud.com/repository/maven' }
jcenter()
mavenCentral()
google()
maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev/'}
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
maven { url 'https://dl.bintray.com/kotlin/kotlin-dev' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath("com.github.jengelman.gradle.plugins:shadow:5.2.0")
classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion"
classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicFuVersion"
}
@ -27,7 +27,9 @@ try {
} else {
project.ext.set("isAndroidSDKAvailable", false)
}
}catch(Exception e){}
} catch (Exception ignored) {
}
allprojects {
group = "net.mamoe"
version = getProperty("mirai_version")

View File

@ -75,11 +75,11 @@ internal abstract class QQAndroidBotBase constructor(
// internally visible only
fun getGroupByUin(uin: Long): Group {
return groups.delegate.filteringGetOrNull { (it as GroupImpl).uin == uin } ?: throw NoSuchElementException("Can not found group with ID=${uin}")
return groups.delegate.getOrNull(uin) ?: throw NoSuchElementException("Can not found group with ID=${uin}")
}
fun getGroupByUinOrNull(uin: Long): Group? {
return groups.delegate.filteringGetOrNull { (it as GroupImpl).uin == uin }
return groups.delegate.getOrNull(uin)
}
override suspend fun queryGroupList(): Sequence<Long> {

View File

@ -16,6 +16,8 @@ import net.mamoe.mirai.utils.*
/**
* 只读联系人列表, lock-free 实现
*
* @see ContactList.asSequence
*/
@UseExperimental(MiraiInternalAPI::class)
@Suppress("unused")