From 407f3cae3e4fbf57707fd198fad0a836ca04b07f Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 6 Mar 2020 22:27:59 +0800 Subject: [PATCH 01/10] Create shadow.yml --- .github/workflows/shadow.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/shadow.yml diff --git a/.github/workflows/shadow.yml b/.github/workflows/shadow.yml new file mode 100644 index 000000000..6c6593f09 --- /dev/null +++ b/.github/workflows/shadow.yml @@ -0,0 +1,34 @@ +name: ShadowPublish + +on: + release: + types: + - created + +jobs: + shadow: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle and shadowJar + run: ./gradlew :mirai-core:shadowJar :mirai-core-qqandroid:shadowJar + - name: Upload artifact + uses: actions/upload-artifact@v1.0.0 + with: + # Artifact name + name: mirai-core-all + # Directory containing files to upload + path: mirai-core/build/libs/mirai-core-*-all.jar + - name: Upload artifact + uses: actions/upload-artifact@v1.0.0 + with: + # Artifact name + name: mirai-core-qqandroid-all + # Directory containing files to upload + path: mirai-core-qqandroid/build/libs/mirai-core-qqandroid-*-all.jar From e60f02a0894d542d05a9a523108084fdb7a2b578 Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 6 Mar 2020 22:31:28 +0800 Subject: [PATCH 02/10] Create shadow-publish.yml --- .github/workflows/shadow-publish.yml | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/shadow-publish.yml diff --git a/.github/workflows/shadow-publish.yml b/.github/workflows/shadow-publish.yml new file mode 100644 index 000000000..31314d2a8 --- /dev/null +++ b/.github/workflows/shadow-publish.yml @@ -0,0 +1,35 @@ + +name: ShadowPublish + +on: + release: + types: + - created + +jobs: + shadow: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle and shadowJar + run: ./gradlew :mirai-core:shadowJar :mirai-core-qqandroid:shadowJar + - name: Upload artifact + uses: actions/upload-artifact@v1.0.0 + with: + # Artifact name + name: mirai-core-all + # Directory containing files to upload + path: mirai-core/build/libs/mirai-core-*-all.jar + - name: Upload artifact + uses: actions/upload-artifact@v1.0.0 + with: + # Artifact name + name: mirai-core-qqandroid-all + # Directory containing files to upload + path: mirai-core-qqandroid/build/libs/mirai-core-qqandroid-*-all.jar From 831593568c4016a8bd51af86bea922df7fa2dcfb Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 6 Mar 2020 22:32:16 +0800 Subject: [PATCH 03/10] Create main2.yml --- .github/workflows/main2.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/main2.yml diff --git a/.github/workflows/main2.yml b/.github/workflows/main2.yml new file mode 100644 index 000000000..ab6a9cb49 --- /dev/null +++ b/.github/workflows/main2.yml @@ -0,0 +1,33 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Run a one-line script + run: echo Hello, world! + + # Runs a set of commands using the runners shell + - name: Run a multi-line script + run: | + echo Add other actions to build, + echo test, and deploy your project. From ccf205dfaa6975d86c581687ee322ef3b3ff71fb Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 6 Mar 2020 22:33:48 +0800 Subject: [PATCH 04/10] Update main2.yml --- .github/workflows/main2.yml | 45 +++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/.github/workflows/main2.yml b/.github/workflows/main2.yml index ab6a9cb49..be05e344f 100644 --- a/.github/workflows/main2.yml +++ b/.github/workflows/main2.yml @@ -5,29 +5,36 @@ name: CI # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch on: - push: - branches: [ master ] - pull_request: - branches: [ master ] + release: + types: + - created # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" build: - # The type of runner that the job will run on runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - # Runs a single command using the runners shell - - name: Run a one-line script - run: echo Hello, world! - - # Runs a set of commands using the runners shell - - name: Run a multi-line script - run: | - echo Add other actions to build, - echo test, and deploy your project. + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle and shadowJar + run: ./gradlew :mirai-core:shadowJar :mirai-core-qqandroid:shadowJar + - name: Upload artifact + uses: actions/upload-artifact@v1.0.0 + with: + # Artifact name + name: mirai-core-all + # Directory containing files to upload + path: "mirai-core/build/libs/mirai-core-*-all.jar" + - name: Upload artifact + uses: actions/upload-artifact@v1.0.0 + with: + # Artifact name + name: mirai-core-qqandroid-all + # Directory containing files to upload + path: "mirai-core-qqandroid/build/libs/mirai-core-qqandroid-*-all.jar" From 9518e2e5b403d4f73b11446fa77ff6490c6d72cc Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 6 Mar 2020 22:34:42 +0800 Subject: [PATCH 05/10] Update main2.yml --- .github/workflows/main2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main2.yml b/.github/workflows/main2.yml index be05e344f..95aba24e3 100644 --- a/.github/workflows/main2.yml +++ b/.github/workflows/main2.yml @@ -1,6 +1,6 @@ # This is a basic workflow to help you get started with Actions -name: CI +name: Shadow # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch From 61debf93b0ea78344e382178b6093a531f4e4c5d Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 6 Mar 2020 22:35:10 +0800 Subject: [PATCH 06/10] Delete shadow-publish.yml --- .github/workflows/shadow-publish.yml | 35 ---------------------------- 1 file changed, 35 deletions(-) delete mode 100644 .github/workflows/shadow-publish.yml diff --git a/.github/workflows/shadow-publish.yml b/.github/workflows/shadow-publish.yml deleted file mode 100644 index 31314d2a8..000000000 --- a/.github/workflows/shadow-publish.yml +++ /dev/null @@ -1,35 +0,0 @@ - -name: ShadowPublish - -on: - release: - types: - - created - -jobs: - shadow: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle and shadowJar - run: ./gradlew :mirai-core:shadowJar :mirai-core-qqandroid:shadowJar - - name: Upload artifact - uses: actions/upload-artifact@v1.0.0 - with: - # Artifact name - name: mirai-core-all - # Directory containing files to upload - path: mirai-core/build/libs/mirai-core-*-all.jar - - name: Upload artifact - uses: actions/upload-artifact@v1.0.0 - with: - # Artifact name - name: mirai-core-qqandroid-all - # Directory containing files to upload - path: mirai-core-qqandroid/build/libs/mirai-core-qqandroid-*-all.jar From d97e7b78562d6885701c1551719ff8290c203cb0 Mon Sep 17 00:00:00 2001 From: Him188 Date: Fri, 6 Mar 2020 22:35:19 +0800 Subject: [PATCH 07/10] Delete shadow.yml --- .github/workflows/shadow.yml | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 .github/workflows/shadow.yml diff --git a/.github/workflows/shadow.yml b/.github/workflows/shadow.yml deleted file mode 100644 index 6c6593f09..000000000 --- a/.github/workflows/shadow.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: ShadowPublish - -on: - release: - types: - - created - -jobs: - shadow: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle and shadowJar - run: ./gradlew :mirai-core:shadowJar :mirai-core-qqandroid:shadowJar - - name: Upload artifact - uses: actions/upload-artifact@v1.0.0 - with: - # Artifact name - name: mirai-core-all - # Directory containing files to upload - path: mirai-core/build/libs/mirai-core-*-all.jar - - name: Upload artifact - uses: actions/upload-artifact@v1.0.0 - with: - # Artifact name - name: mirai-core-qqandroid-all - # Directory containing files to upload - path: mirai-core-qqandroid/build/libs/mirai-core-qqandroid-*-all.jar From 03f873276af6fbd4576df901567f8f128bea95aa Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 7 Mar 2020 00:24:22 +0800 Subject: [PATCH 08/10] Enhance `flatten` and `asMessageChain` --- .../message/data/CombinedMessage.kt | 4 ++ .../message/data/MessageChain.kt | 47 ++++++++++++++++--- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/CombinedMessage.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/CombinedMessage.kt index f632f790b..73c4fa2c8 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/CombinedMessage.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/CombinedMessage.kt @@ -58,4 +58,8 @@ class CombinedMessage( override fun toString(): String { return element.toString() + left.toString() } + + fun isFlat(): Boolean { + return element is SingleMessage && left is SingleMessage + } } \ No newline at end of file diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt index 48eecf939..c59e942ac 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageChain.kt @@ -61,7 +61,7 @@ interface MessageChain : Message, Iterable { fun getOrNull(key: Message.Key): M? = firstOrNull(key) /** - * 遍历每一个有内容的消息, 即 [At], [AtAll], [PlainText], [Image], [Face], [XMLMessage]. + * 遍历每一个有内容的消息, 即 [At], [AtAll], [PlainText], [Image], [Face], [XMLMessage], [QuoteReply]. * 仅供 `Java` 使用 */ @Suppress("FunctionName", "INAPPLICABLE_JVM_NAME") @@ -71,13 +71,26 @@ interface MessageChain : Message, Iterable { fun `__forEachContent for Java__`(block: (Message) -> Unit) { this.foreachContent(block) } + + /** + * 遍历每一个消息, 即 [MessageSource] [At], [AtAll], [PlainText], [Image], [Face], [XMLMessage], [QuoteReply]. + * 仅供 `Java` 使用 + */ + @Suppress("FunctionName", "INAPPLICABLE_JVM_NAME") + @JsName("forEach") + @JvmName("forEach") + @MiraiInternalAPI + fun `__forEach for Java__`(block: (Message) -> Unit) { + this.forEach(block) + } } // region accessors /** - * 遍历每一个有内容的消息, 即 [At], [AtAll], [PlainText], [Image], [Face], [XMLMessage] + * 遍历每一个有内容的消息, 即 [At], [AtAll], [PlainText], [Image], [Face], [XMLMessage], [QuoteReply] */ +@JvmSynthetic inline fun MessageChain.foreachContent(block: (Message) -> Unit) { this.forEach { if (it !is MessageMetadata) block(it) @@ -87,23 +100,27 @@ inline fun MessageChain.foreachContent(block: (Message) -> Unit) { /** * 获取第一个 [M] 类型的 [Message] 实例 */ +@JvmSynthetic inline fun MessageChain.firstOrNull(): M? = this.firstOrNull { it is M } as M? /** * 获取第一个 [M] 类型的 [Message] 实例 * @throws [NoSuchElementException] 如果找不到该类型的实例 */ +@JvmSynthetic inline fun MessageChain.first(): M = this.first { it is M } as M /** * 获取第一个 [M] 类型的 [Message] 实例 */ +@JvmSynthetic inline fun MessageChain.any(): Boolean = this.any { it is M } /** * 获取第一个 [M] 类型的 [Message] 实例 */ +@JvmSynthetic @Suppress("UNCHECKED_CAST") fun MessageChain.firstOrNull(key: Message.Key): M? = when (key) { At -> first() @@ -120,6 +137,7 @@ fun MessageChain.firstOrNull(key: Message.Key): M? = when (key) * 获取第一个 [M] 类型的 [Message] 实例 * @throws [NoSuchElementException] 如果找不到该类型的实例 */ +@JvmSynthetic @Suppress("UNCHECKED_CAST") fun MessageChain.first(key: Message.Key): M = firstOrNull(key) ?: throw NoSuchElementException("no such element: $key") @@ -127,6 +145,7 @@ fun MessageChain.first(key: Message.Key): M = /** * 获取第一个 [M] 类型的 [Message] 实例 */ +@JvmSynthetic @Suppress("UNCHECKED_CAST") fun MessageChain.any(key: Message.Key): Boolean = firstOrNull(key) != null @@ -211,9 +230,6 @@ fun Message.asMessageChain(): MessageChain = when (this) { else -> SingleMessageChainImpl(this as SingleMessage) } -@Deprecated("use asMessageChain instead", ReplaceWith("this.asMessageChain()"), DeprecationLevel.ERROR) -fun Message.toChain(): MessageChain = this.asMessageChain() - /** * 直接将 [this] 委托为一个 [MessageChain] */ @@ -233,8 +249,18 @@ fun Collection.asMessageChain(): MessageChain = MessageChainImplBySeque @JvmSynthetic fun Iterable.asMessageChain(): MessageChain = MessageChainImplByIterable(this) +@JvmSynthetic inline fun MessageChain.asMessageChain(): MessageChain = this // 避免套娃 +@JvmSynthetic +fun CombinedMessage.asMessageChain(): MessageChain { + if (left is SingleMessage && this.element is SingleMessage) { + @Suppress("UNCHECKED_CAST") + return (this as Iterable).asMessageChain() + } + return (this as Iterable).asMessageChain() +} // 避免套娃 + /** * 将 [this] [扁平化后][flatten] 委托为一个 [MessageChain] */ @@ -324,11 +350,20 @@ fun Sequence.flatten(): Sequence = this // fast pa fun Message.flatten(): Sequence { return when (this) { is MessageChain -> this.asSequence() - is CombinedMessage -> this.asSequence().flatten() + is CombinedMessage -> this.flatten() else -> sequenceOf(this as SingleMessage) } } +fun CombinedMessage.flatten(): Sequence { + if (this.isFlat()){ + @Suppress("UNCHECKED_CAST") + return (this as Iterable).asSequence() + } else return this.asSequence().flatten() +} + +fun MessageChain.flatten(): Sequence = this.asSequence() // fast path + // endregion converters // region implementations From e222465dedeab18b76c90b36964a36a9973f5c82 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 7 Mar 2020 00:24:37 +0800 Subject: [PATCH 09/10] Make `account` internal --- .../net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt | 2 +- mirai-core/src/androidMain/kotlin/net/mamoe/mirai/Bot.kt | 6 ------ mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt | 6 ------ .../src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt | 3 +++ .../src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt | 4 +++- .../src/commonMain/kotlin/net.mamoe.mirai/lowLevelApi.kt | 9 +++++++++ mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/Bot.kt | 6 ------ 7 files changed, 16 insertions(+), 20 deletions(-) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt index 7d2801ffa..76df1763d 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidClient.kt @@ -160,7 +160,7 @@ internal open class QQAndroidClient( @UseExperimental(RawAccountIdUse::class) @Suppress("PropertyName") - internal var _uin: Long = bot.account.id + internal var _uin: Long = bot.uin var t530: ByteArray? = null var t528: ByteArray? = null diff --git a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/Bot.kt b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/Bot.kt index 48c629081..de70962a5 100644 --- a/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/Bot.kt +++ b/mirai-core/src/androidMain/kotlin/net/mamoe/mirai/Bot.kt @@ -54,12 +54,6 @@ actual abstract class Bot actual constructor() : CoroutineScope, LowLevelBotAPIA */ actual abstract val context: Context - /** - * 账号信息 - */ - @MiraiInternalAPI - actual abstract val account: BotAccount - /** * QQ 号码. 实际类型为 uint */ diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt index e8a25b56e..54bb1308e 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/Bot.kt @@ -70,12 +70,6 @@ expect abstract class Bot() : CoroutineScope, LowLevelBotAPIAccessor { */ abstract val context: Context - /** - * 账号信息 - */ - @MiraiInternalAPI - abstract val account: BotAccount - /** * QQ 号码. 实际类型为 uint */ diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt index fe0ff4b4d..b4c84333a 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotAccount.kt @@ -12,6 +12,7 @@ package net.mamoe.mirai import io.ktor.utils.io.core.toByteArray +import net.mamoe.mirai.utils.MiraiExperimentalAPI import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.md5 import kotlin.annotation.AnnotationTarget.* @@ -23,6 +24,8 @@ data class BotAccount( */ @RawAccountIdUse val id: Long, + @MiraiExperimentalAPI + @MiraiInternalAPI val passwordMd5: ByteArray // md5 ) { constructor(id: Long, passwordPlainText: String) : this(id, md5(passwordPlainText.toByteArray())) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt index da87be75c..3ead4f73b 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt @@ -40,9 +40,11 @@ abstract class BotImpl constructor( ?: CoroutineExceptionHandler { _, e -> logger.error("An exception was thrown under a coroutine of Bot", e) }) override val context: Context by context.unsafeWeakRef() - @Suppress("CanBePrimaryConstructorProperty") // for logger + @UseExperimental(LowLevelAPI::class) + @Suppress("CanBePrimaryConstructorProperty", "OverridingDeprecatedMember") // for logger final override val account: BotAccount = account + @Suppress("DEPRECATION_ERROR") @UseExperimental(RawAccountIdUse::class) override val uin: Long get() = account.id diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/lowLevelApi.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/lowLevelApi.kt index 0940819a6..08387696a 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/lowLevelApi.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/lowLevelApi.kt @@ -17,6 +17,7 @@ import net.mamoe.mirai.data.GroupInfo import net.mamoe.mirai.data.MemberInfo import net.mamoe.mirai.message.data.MessageSource import net.mamoe.mirai.utils.MiraiExperimentalAPI +import net.mamoe.mirai.utils.MiraiInternalAPI import net.mamoe.mirai.utils.WeakRef /** @@ -37,6 +38,14 @@ annotation class LowLevelAPI @Suppress("FunctionName", "unused") @LowLevelAPI interface LowLevelBotAPIAccessor { + /** + * 账号信息 + */ + @Deprecated("将来会做修改", level = DeprecationLevel.ERROR) + @MiraiExperimentalAPI + @LowLevelAPI + @MiraiInternalAPI + abstract val account: BotAccount /** * 构造一个 [_lowLevelNewQQ] 对象. 它持有对 [Bot] 的弱引用([WeakRef]). diff --git a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/Bot.kt b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/Bot.kt index 509ed8381..93c0ebd52 100644 --- a/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/Bot.kt +++ b/mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/Bot.kt @@ -64,12 +64,6 @@ actual abstract class Bot actual constructor() : CoroutineScope, LowLevelBotAPIA */ actual abstract val context: Context - /** - * 账号信息 - */ - @MiraiInternalAPI - actual abstract val account: BotAccount - /** * QQ 号码. 实际类型为 uint */ From fea2acbb85ff2f97d4a666eb08a68a83c069e6c8 Mon Sep 17 00:00:00 2001 From: Him188 Date: Sat, 7 Mar 2020 00:28:27 +0800 Subject: [PATCH 10/10] Remove useless reference --- mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt index 3ead4f73b..2596426c8 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/BotImpl.kt @@ -7,7 +7,7 @@ * https://github.com/mamoe/mirai/blob/master/LICENSE */ -@file:Suppress("EXPERIMENTAL_API_USAGE") +@file:Suppress("EXPERIMENTAL_API_USAGE", "DEPRECATION_ERROR") package net.mamoe.mirai @@ -44,10 +44,9 @@ abstract class BotImpl constructor( @Suppress("CanBePrimaryConstructorProperty", "OverridingDeprecatedMember") // for logger final override val account: BotAccount = account - @Suppress("DEPRECATION_ERROR") @UseExperimental(RawAccountIdUse::class) override val uin: Long - get() = account.id + get() = this.account.id final override val logger: MiraiLogger by lazy { configuration.botLoggerSupplier(this) } init {