mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-27 17:00:14 +08:00
Rearrange module structure:
- Rename mirai-core to mirai-core-api - Rename mirai-core-qqandroid to mirai-core - Rename package net.mamoe.mirai.qqandroid to net.mamoe.mirai.internal - Delete old android targets - Configure default packages correctly - Update licenses
This commit is contained in:
parent
fb2f437a21
commit
a9d4d14576
45
.travis.yml
45
.travis.yml
@ -1,45 +0,0 @@
|
||||
language: android
|
||||
|
||||
jdk: oraclejdk8
|
||||
### need JDK11
|
||||
|
||||
env:
|
||||
global:
|
||||
- ANDROID_API_LEVEL=28
|
||||
- ANDROID_BUILD_TOOLS_VERSION=28.0.3
|
||||
- ANDROID_ABI=armeabi-v7a
|
||||
|
||||
android:
|
||||
components:
|
||||
- tools
|
||||
- platform-tools
|
||||
- tools
|
||||
- extra-android-m2repository
|
||||
licenses:
|
||||
- 'android-sdk-preview-license-52d11cd2'
|
||||
- 'android-sdk-license-.+'
|
||||
- 'google-gdk-license-.+'
|
||||
|
||||
before_install:
|
||||
- touch $HOME/.android/repositories.cfg
|
||||
- yes | sdkmanager "platforms;android-28"
|
||||
- yes | sdkmanager "build-tools;28.0.3"
|
||||
|
||||
### need JDK8( SDK manager thing)
|
||||
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.gradle/caches/
|
||||
- $HOME/.gradle/wrapper/
|
||||
- $HOME/.android/build-cache
|
||||
|
||||
before_script:
|
||||
- chmod +x gradlew
|
||||
|
||||
script:
|
||||
- ./gradlew clean build
|
||||
- ./gradlew test
|
@ -31,7 +31,7 @@ mirai 欢迎一切形式的代码贡献。你可以通过以下几种途径向 m
|
||||
### 注意事项
|
||||
- 尽量不要引用新的库
|
||||
- 遵守 Kotlin 官方代码规范(提交前使用 IDE 格式化代码 (commit 时勾选 'Reformat code'))
|
||||
- 不要手动拆解数据包. 请一定使用 `kotlinx.serialization` 拆解 ProtoBuf, 使用 `net.mamoe.mirai.qqandroid.utils.io.serialization.Tars` 拆解 Tars 数据包, 使用 `kotlinx.serialization` 拆解 Json 数据.
|
||||
- 不要手动拆解数据包. 请一定使用 `kotlinx.serialization` 拆解 ProtoBuf, 使用 `net.mamoe.mirai.internal.utils.io.serialization.Tars` 拆解 Tars 数据包, 使用 `kotlinx.serialization` 拆解 Json 数据.
|
||||
|
||||
## 社区
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
theme: jekyll-theme-cayman
|
@ -273,19 +273,19 @@ subprojects {
|
||||
suppress = true
|
||||
}
|
||||
perPackageOption {
|
||||
prefix = "net.mamoe.mirai.qqandroid.utils"
|
||||
prefix = "net.mamoe.mirai.internal.utils"
|
||||
suppress = true
|
||||
}
|
||||
perPackageOption {
|
||||
prefix = "net.mamoe.mirai.qqandroid.contact"
|
||||
prefix = "net.mamoe.mirai.internal.contact"
|
||||
suppress = true
|
||||
}
|
||||
perPackageOption {
|
||||
prefix = "net.mamoe.mirai.qqandroid.message"
|
||||
prefix = "net.mamoe.mirai.internal.message"
|
||||
suppress = true
|
||||
}
|
||||
perPackageOption {
|
||||
prefix = "net.mamoe.mirai.qqandroid.network"
|
||||
prefix = "net.mamoe.mirai.internal.network"
|
||||
suppress = true
|
||||
}
|
||||
}
|
||||
|
@ -3,16 +3,13 @@ import java.io.OutputStream
|
||||
import java.security.MessageDigest
|
||||
|
||||
/*
|
||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
||||
*
|
||||
* * Copyright 2020 Mamoe Technologies and contributors.
|
||||
* *
|
||||
* * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
* *
|
||||
* * https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link.
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
@OptIn(ExperimentalUnsignedTypes::class)
|
||||
fun ByteArray.toUHexString(
|
||||
separator: String = " ",
|
||||
|
@ -1,49 +0,0 @@
|
||||
@file:Suppress("UNUSED_VARIABLE")
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
java
|
||||
}
|
||||
|
||||
description = "Binary and source compatibility validator for mirai-core and mirai-core-qqandroid"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
all {
|
||||
languageSettings.enableLanguageFeature("InlineClasses")
|
||||
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
|
||||
}
|
||||
|
||||
main {
|
||||
dependencies {
|
||||
api(kotlin("stdlib", Versions.Kotlin.stdlib))
|
||||
runtimeOnly(project(":mirai-core-qqandroid"))
|
||||
compileOnly("net.mamoe:mirai-core-qqandroid:0.38.0")
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
dependencies {
|
||||
api(kotlin("stdlib", Versions.Kotlin.stdlib))
|
||||
api(kotlin("test"))
|
||||
api(kotlin("test-junit"))
|
||||
runtimeOnly(project(":mirai-core-qqandroid"))
|
||||
compileOnly("net.mamoe:mirai-core-qqandroid:0.38.0")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package compatibility;
|
||||
|
||||
import net.mamoe.mirai.Bot;
|
||||
import net.mamoe.mirai.BotFactoryJvm;
|
||||
import net.mamoe.mirai.message.data.MessageUtils;
|
||||
|
||||
/*
|
||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 with Mamoe Exceptions 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 with Mamoe Exceptions license that can be found via the following link.
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
public class CompatibilityTest {
|
||||
public static void main(String[] args) {
|
||||
Bot bot = BotFactoryJvm.newBot(Long.parseLong(System.getenv("qq")), System.getenv("password"));
|
||||
|
||||
bot.getFriend(123).sendMessage(MessageUtils.newChain("")
|
||||
.plus("")
|
||||
.plus(MessageUtils.newImage("")));
|
||||
bot.getFriend(123).sendMessage("");
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
package compatibility
|
||||
|
||||
import net.mamoe.mirai.message.data.*
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
|
||||
internal class CombinedMessageTest {
|
||||
|
||||
|
||||
@Test
|
||||
fun testAsSequence() {
|
||||
var message: Message = "Hello ".toMessage()
|
||||
message += "World"
|
||||
|
||||
assertEquals(
|
||||
"Hello World",
|
||||
(message as CombinedMessage).asSequence().joinToString(separator = "")
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testAsSequence2() {
|
||||
var message: Message = "Hello ".toMessage()
|
||||
message += listOf(
|
||||
PlainText("W"),
|
||||
PlainText("o"),
|
||||
PlainText("r") + PlainText("ld")
|
||||
).asMessageChain()
|
||||
|
||||
assertEquals(
|
||||
"Hello World",
|
||||
(message as CombinedMessage).asSequence().joinToString(separator = "")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun <T> Iterator<T>.joinToString(
|
||||
separator: CharSequence = ", ",
|
||||
prefix: CharSequence = "",
|
||||
postfix: CharSequence = "",
|
||||
limit: Int = -1,
|
||||
truncated: CharSequence = "...",
|
||||
transform: ((T) -> CharSequence)? = null
|
||||
): String {
|
||||
return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()
|
||||
}
|
||||
|
||||
fun <T, A : Appendable> Iterator<T>.joinTo(
|
||||
buffer: A,
|
||||
separator: CharSequence = ", ",
|
||||
prefix: CharSequence = "",
|
||||
postfix: CharSequence = "",
|
||||
limit: Int = -1,
|
||||
truncated: CharSequence = "...",
|
||||
transform: ((T) -> CharSequence)? = null
|
||||
): A {
|
||||
buffer.append(prefix)
|
||||
var count = 0
|
||||
for (element in this) {
|
||||
if (++count > 1) buffer.append(separator)
|
||||
if (limit < 0 || count <= limit) {
|
||||
buffer.appendElement(element, transform)
|
||||
} else break
|
||||
}
|
||||
if (limit in 0 until count) buffer.append(truncated)
|
||||
buffer.append(postfix)
|
||||
return buffer
|
||||
}
|
||||
|
||||
internal fun <T> Appendable.appendElement(element: T, transform: ((T) -> CharSequence)?) {
|
||||
when {
|
||||
transform != null -> append(transform(element))
|
||||
element is CharSequence? -> append(element)
|
||||
element is Char -> append(element)
|
||||
else -> append(element.toString())
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link.
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
package compatibility
|
||||
|
||||
import net.mamoe.mirai.message.data.Message
|
||||
import net.mamoe.mirai.message.data.PlainText
|
||||
import org.junit.Test
|
||||
|
||||
|
||||
internal class TestKotlinCompatibility {
|
||||
|
||||
@Test
|
||||
fun testMessageChain() {
|
||||
val x = PlainText("te") + PlainText("st")
|
||||
|
||||
println(Message::class.java.declaredMethods.joinToString("\n"))
|
||||
println()
|
||||
println(x::class.java.declaredMethods.joinToString("\n"))
|
||||
}
|
||||
}
|
@ -20,9 +20,9 @@
|
||||
mirai 项目整体由 核心 (`mirai-core`) 与 控制台(`mirai-console`) 组成.
|
||||
|
||||
|
||||
- [`mirai-core`](../mirai-core) 是机器人服务支持**库**. 提供所有机器人相关 API. **本身只包含抽象类和接口, 使用时还需要同时依赖协议模块**.
|
||||
- [`mirai-core`](../mirai-core-api) 是机器人服务支持**库**. 提供所有机器人相关 API. **本身只包含抽象类和接口, 使用时还需要同时依赖协议模块**.
|
||||
可用的协议模块:
|
||||
- [`mirai-core-qqandroid`](../mirai-core-qqandroid): Android QQ 8.3.0 版本协议实现.
|
||||
- [`mirai-core-qqandroid`](../mirai-core): Android QQ 8.3.0 版本协议实现.
|
||||
|
||||
`mirai-core` 设计为一个 **`支持库`**, 意味着它可以被独立依赖, 在任意项目中使用. 详见下文.
|
||||
|
||||
|
@ -5,9 +5,9 @@ apiValidation {
|
||||
]
|
||||
|
||||
ignoredPackages += [
|
||||
"net.mamoe.mirai.qqandroid.contact",
|
||||
"net.mamoe.mirai.qqandroid.message",
|
||||
"net.mamoe.mirai.qqandroid.network",
|
||||
"net.mamoe.mirai.qqandroid.utils"
|
||||
"net.mamoe.mirai.internal.contact",
|
||||
"net.mamoe.mirai.internal.message",
|
||||
"net.mamoe.mirai.internal.network",
|
||||
"net.mamoe.mirai.internal.utils"
|
||||
]
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
@file:Suppress("UNUSED_VARIABLE")
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
java
|
||||
}
|
||||
|
||||
description = "Java compatibility validator for mirai-core and mirai-core-qqandroid"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
all {
|
||||
languageSettings.enableLanguageFeature("InlineClasses")
|
||||
languageSettings.useExperimentalAnnotation("kotlin.Experimental")
|
||||
}
|
||||
|
||||
main {
|
||||
dependencies {
|
||||
api(kotlin("stdlib", Versions.Kotlin.stdlib))
|
||||
api(project(":mirai-core-qqandroid"))
|
||||
}
|
||||
}
|
||||
|
||||
test {
|
||||
dependencies {
|
||||
api(kotlin("stdlib", Versions.Kotlin.stdlib))
|
||||
api(kotlin("test"))
|
||||
api(kotlin("test-junit"))
|
||||
api(project(":mirai-core-qqandroid"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
|
||||
kotlinOptions.jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package test;
|
||||
|
||||
import net.mamoe.mirai.Bot;
|
||||
import net.mamoe.mirai.contact.Contact;
|
||||
import net.mamoe.mirai.contact.QQ;
|
||||
|
||||
/*
|
||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 with Mamoe Exceptions 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 with Mamoe Exceptions license that can be found via the following link.
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
public class MPPCompatibilityTest {
|
||||
public static void main(String[] args) {
|
||||
final QQ next = Bot.getInstances().get(0).getFriends().iterator().next();
|
||||
((Contact) next).sendMessage("");
|
||||
}
|
||||
}
|
@ -54,7 +54,7 @@ kotlin {
|
||||
|
||||
dependencies {
|
||||
api(project(":mirai-core"))
|
||||
api(project(":mirai-core-qqandroid"))
|
||||
api(project(":mirai-core-api"))
|
||||
}
|
||||
|
||||
setupPublishing("mirai-core-all")
|
10
mirai-core-api/README.md
Normal file
10
mirai-core-api/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
# mirai-core
|
||||
|
||||
mirai 的核心公开 API.
|
||||
|
||||
mirai 为多协议设计, `mirai-core` 只提供基础框架和抽象数据类.
|
||||
具体的各协议实现为 `mirai-core-PROTOCOL`, 这些协议模块都继承自 `mirai-core`.
|
||||
|
||||
可用的协议模块:
|
||||
- [`mirai-core-qqandroid`](../mirai-core): Android QQ 8.3.0 版本协议实现.
|
||||
|
@ -4,16 +4,19 @@ plugins {
|
||||
kotlin("multiplatform")
|
||||
id("kotlinx-atomicfu")
|
||||
kotlin("plugin.serialization")
|
||||
id("signing")
|
||||
id("net.mamoe.kotlin-jvm-blocking-bridge")
|
||||
`maven-publish`
|
||||
id("com.jfrog.bintray")
|
||||
}
|
||||
|
||||
description = "Mirai Protocol implementation for QQ Android"
|
||||
description = "Mirai API module"
|
||||
|
||||
val isAndroidSDKAvailable: Boolean by project
|
||||
|
||||
kotlin {
|
||||
explicitApi()
|
||||
|
||||
if (isAndroidSDKAvailable) {
|
||||
apply(from = rootProject.file("gradle/android.gradle"))
|
||||
android("android") {
|
||||
@ -34,7 +37,8 @@ kotlin {
|
||||
)
|
||||
}
|
||||
|
||||
jvm("jvm") {
|
||||
jvm {
|
||||
// withJava() // https://youtrack.jetbrains.com/issue/KT-39991
|
||||
}
|
||||
|
||||
sourceSets.apply {
|
||||
@ -52,41 +56,50 @@ kotlin {
|
||||
languageSettings.useExperimentalAnnotation("net.mamoe.mirai.utils.UnstableExternalImage")
|
||||
|
||||
languageSettings.progressiveMode = true
|
||||
|
||||
dependencies {
|
||||
api(project(":mirai-core"))
|
||||
}
|
||||
}
|
||||
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
api(kotlin("serialization"))
|
||||
api(kotlin("reflect"))
|
||||
|
||||
api1(kotlinx("serialization-core", Versions.Kotlin.serialization))
|
||||
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
|
||||
implementation1(kotlinx("serialization-protobuf", Versions.Kotlin.serialization))
|
||||
api1("org.jetbrains.kotlinx:atomicfu:${Versions.Kotlin.atomicFU}")
|
||||
api1(kotlinx("io", Versions.Kotlin.io))
|
||||
implementation1(kotlinx("coroutines-io", Versions.Kotlin.coroutinesIo))
|
||||
api1(kotlinx("coroutines-io", Versions.Kotlin.coroutinesIo))
|
||||
api(kotlinx("coroutines-core", Versions.Kotlin.coroutines))
|
||||
|
||||
implementation1("org.jetbrains.kotlinx:atomicfu:${Versions.Kotlin.atomicFU}")
|
||||
|
||||
api1(ktor("client-cio"))
|
||||
api1(ktor("client-core"))
|
||||
api1(ktor("network"))
|
||||
}
|
||||
}
|
||||
|
||||
val commonTest by getting {
|
||||
commonTest {
|
||||
dependencies {
|
||||
implementation(kotlin("test-annotations-common"))
|
||||
implementation(kotlin("test-common"))
|
||||
implementation(kotlin("script-runtime"))
|
||||
}
|
||||
}
|
||||
|
||||
if (isAndroidSDKAvailable) {
|
||||
val androidMain by getting {
|
||||
dependencies {
|
||||
api(kotlin("reflect"))
|
||||
|
||||
api1(kotlinx("io-jvm", Versions.Kotlin.io))
|
||||
api1(kotlinx("coroutines-io-jvm", Versions.Kotlin.coroutinesIo))
|
||||
|
||||
api1(ktor("client-android", Versions.Kotlin.ktor))
|
||||
}
|
||||
}
|
||||
|
||||
val androidTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test", Versions.Kotlin.compiler))
|
||||
implementation(kotlin("test-junit", Versions.Kotlin.compiler))
|
||||
implementation(kotlin("test"))
|
||||
implementation(kotlin("test-junit"))
|
||||
implementation(kotlin("test-annotations-common"))
|
||||
implementation(kotlin("test-common"))
|
||||
}
|
||||
@ -95,18 +108,23 @@ kotlin {
|
||||
|
||||
val jvmMain by getting {
|
||||
dependencies {
|
||||
implementation("org.bouncycastle:bcprov-jdk15on:1.64")
|
||||
api(kotlin("reflect"))
|
||||
compileOnly("org.apache.logging.log4j:log4j-api:" + Versions.Logging.log4j)
|
||||
compileOnly("org.slf4j:slf4j-api:" + Versions.Logging.slf4j)
|
||||
|
||||
api1(ktor("client-core-jvm", Versions.Kotlin.ktor))
|
||||
api1(kotlinx("io-jvm", Versions.Kotlin.io))
|
||||
// api(kotlinx("coroutines-debug", Versions.Kotlin.coroutines))
|
||||
api1(kotlinx("coroutines-io-jvm", Versions.Kotlin.coroutinesIo))
|
||||
}
|
||||
}
|
||||
|
||||
val jvmTest by getting {
|
||||
dependencies {
|
||||
dependsOn(commonTest)
|
||||
implementation(kotlin("test", Versions.Kotlin.compiler))
|
||||
implementation(kotlin("test-junit", Versions.Kotlin.compiler))
|
||||
implementation(kotlin("test"))
|
||||
implementation(kotlin("test-junit"))
|
||||
implementation("org.pcap4j:pcap4j-distribution:1.8.2")
|
||||
|
||||
runtimeOnly(files("build/classes/kotlin/jvm/test")) // classpath is not properly set by IDE
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -132,7 +150,6 @@ fun org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler.api1(dependencyNo
|
||||
|
||||
apply(from = rootProject.file("gradle/publish.gradle"))
|
||||
|
||||
|
||||
tasks.withType<com.jfrog.bintray.gradle.tasks.BintrayUploadTask> {
|
||||
doFirst {
|
||||
publishing.publications
|
@ -6,7 +6,6 @@
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
@file:Suppress(
|
||||
"EXPERIMENTAL_API_USAGE", "unused", "FunctionName", "NOTHING_TO_INLINE", "UnusedImport",
|
||||
"EXPERIMENTAL_OVERRIDE", "CanBeParameter", "MemberVisibilityCanBePrivate"
|
||||
@ -236,7 +235,7 @@ public abstract class Bot internal constructor(
|
||||
@PlannedRemoval("1.2.0")
|
||||
@Deprecated(
|
||||
"use extension.",
|
||||
replaceWith = ReplaceWith("image.queryUrl()", imports = ["net.mamoe.mirai.message.data.queryUrl"]),
|
||||
replaceWith = ReplaceWith("image.queryUrl()", imports = ["queryUrl"]),
|
||||
level = DeprecationLevel.ERROR
|
||||
)
|
||||
@JvmSynthetic
|
@ -6,7 +6,6 @@
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
@file:Suppress("FunctionName", "INAPPLICABLE_JVM_NAME", "DEPRECATION_ERROR", "DeprecatedCallableAddReplaceWith")
|
||||
|
||||
package net.mamoe.mirai
|
@ -1,6 +1,9 @@
|
||||
package net.mamoe.mirai.data
|
||||
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Serializer
|
||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
@ -37,7 +37,7 @@ import kotlin.jvm.JvmName
|
||||
//
|
||||
//
|
||||
////
|
||||
//// 此文件存放所有 `net.mamoe.mirai.event.subscribeMessages` 已弃用的函数.
|
||||
//// 此文件存放所有 `subscribeMessages` 已弃用的函数.
|
||||
////
|
||||
//
|
||||
//
|
@ -16,8 +16,8 @@ package net.mamoe.mirai.event.events
|
||||
import net.mamoe.mirai.Bot
|
||||
import net.mamoe.mirai.contact.User
|
||||
import net.mamoe.mirai.event.AbstractEvent
|
||||
import net.mamoe.mirai.internal.network.Packet
|
||||
import net.mamoe.mirai.message.action.Nudge
|
||||
import net.mamoe.mirai.qqandroid.network.Packet
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
@ -20,7 +20,7 @@ import net.mamoe.mirai.contact.Group
|
||||
import net.mamoe.mirai.contact.User
|
||||
import net.mamoe.mirai.event.AbstractEvent
|
||||
import net.mamoe.mirai.event.internal.MiraiAtomicBoolean
|
||||
import net.mamoe.mirai.qqandroid.network.Packet
|
||||
import net.mamoe.mirai.internal.network.Packet
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import net.mamoe.mirai.utils.internal.runBlocking
|
||||
import kotlin.jvm.*
|
@ -22,8 +22,8 @@ import net.mamoe.mirai.contact.MemberPermission
|
||||
import net.mamoe.mirai.event.AbstractEvent
|
||||
import net.mamoe.mirai.event.BroadcastControllable
|
||||
import net.mamoe.mirai.event.internal.MiraiAtomicBoolean
|
||||
import net.mamoe.mirai.internal.network.Packet
|
||||
import net.mamoe.mirai.message.action.Nudge
|
||||
import net.mamoe.mirai.qqandroid.network.Packet
|
||||
import net.mamoe.mirai.utils.MiraiExperimentalAPI
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
import net.mamoe.mirai.utils.internal.runBlocking
|
@ -19,12 +19,12 @@ import net.mamoe.mirai.event.AbstractEvent
|
||||
import net.mamoe.mirai.event.CancellableEvent
|
||||
import net.mamoe.mirai.event.events.ImageUploadEvent.Failed
|
||||
import net.mamoe.mirai.event.events.ImageUploadEvent.Succeed
|
||||
import net.mamoe.mirai.internal.network.Packet
|
||||
import net.mamoe.mirai.message.MessageReceipt
|
||||
import net.mamoe.mirai.message.data.Image
|
||||
import net.mamoe.mirai.message.data.Message
|
||||
import net.mamoe.mirai.message.data.MessageChain
|
||||
import net.mamoe.mirai.message.data.MessageSource
|
||||
import net.mamoe.mirai.qqandroid.network.Packet
|
||||
import net.mamoe.mirai.utils.ExternalImage
|
||||
import net.mamoe.mirai.utils.PlannedRemoval
|
||||
import net.mamoe.mirai.utils.SinceMirai
|
||||
@ -403,7 +403,7 @@ public sealed class ImageUploadEvent : BotEvent, BotActiveEvent, AbstractEvent()
|
||||
message = """
|
||||
以 MessagePreSendEvent 和 MessagePostSendEvent 替换.
|
||||
""",
|
||||
replaceWith = ReplaceWith("MessagePreSendEvent", "net.mamoe.mirai.event.events.MessagePreSendEvent"),
|
||||
replaceWith = ReplaceWith("MessagePreSendEvent", "MessagePreSendEvent"),
|
||||
level = DeprecationLevel.WARNING
|
||||
)
|
||||
public sealed class MessageSendEvent : BotEvent, BotActiveEvent, AbstractEvent() {
|
||||
@ -415,7 +415,7 @@ public sealed class MessageSendEvent : BotEvent, BotActiveEvent, AbstractEvent()
|
||||
message = """
|
||||
以 GroupMessagePreSendEvent 和 GroupMessagePostSendEvent 替换.
|
||||
""",
|
||||
replaceWith = ReplaceWith("GroupMessagePreSendEvent", "net.mamoe.mirai.event.events.GroupMessagePreSendEvent"),
|
||||
replaceWith = ReplaceWith("GroupMessagePreSendEvent", "GroupMessagePreSendEvent"),
|
||||
level = DeprecationLevel.WARNING
|
||||
)
|
||||
public data class GroupMessageSendEvent internal constructor(
|
||||
@ -429,7 +429,7 @@ public sealed class MessageSendEvent : BotEvent, BotActiveEvent, AbstractEvent()
|
||||
""",
|
||||
replaceWith = ReplaceWith(
|
||||
"FriendMessagePreSendEvent",
|
||||
"net.mamoe.mirai.event.events.FriendMessagePreSendEvent"
|
||||
"FriendMessagePreSendEvent"
|
||||
),
|
||||
level = DeprecationLevel.WARNING
|
||||
)
|
||||
@ -442,7 +442,7 @@ public sealed class MessageSendEvent : BotEvent, BotActiveEvent, AbstractEvent()
|
||||
message = """
|
||||
以 TempMessagePreSendEvent 和 TempMessagePostSendEvent 替换.
|
||||
""",
|
||||
replaceWith = ReplaceWith("TempMessagePreSendEvent", "net.mamoe.mirai.event.events.TempMessagePreSendEvent"),
|
||||
replaceWith = ReplaceWith("TempMessagePreSendEvent", "TempMessagePreSendEvent"),
|
||||
level = DeprecationLevel.WARNING
|
||||
)
|
||||
public data class TempMessageSendEvent internal constructor(
|
@ -6,7 +6,6 @@
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
package net.mamoe.mirai
|
||||
|
||||
/**
|
@ -1,14 +1,11 @@
|
||||
/*
|
||||
* Copyright 2019-2020 Mamoe Technologies and contributors.
|
||||
*
|
||||
* * Copyright 2020 Mamoe Technologies and contributors.
|
||||
* *
|
||||
* * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
* *
|
||||
* * https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AFFERO GENERAL PUBLIC LICENSE version 3 license that can be found via the following link.
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
package net.mamoe.mirai.message.action
|
||||
|
||||
import net.mamoe.kjbb.JvmBlockingBridge
|
@ -52,7 +52,7 @@ public data class PlainText(
|
||||
*/
|
||||
@Deprecated(
|
||||
"为和 mirai code 区分, 请使用 PlainText(this)",
|
||||
ReplaceWith("PlainText(this)", "net.mamoe.mirai.message.data.PlainText"),
|
||||
ReplaceWith("PlainText(this)", "PlainText"),
|
||||
level = DeprecationLevel.WARNING
|
||||
)
|
||||
@JvmSynthetic
|
@ -48,7 +48,7 @@ internal const val ONLINE_OFFLINE_DEPRECATION_MESSAGE = """
|
||||
@Deprecated(
|
||||
ONLINE_OFFLINE_DEPRECATION_MESSAGE,
|
||||
level = DeprecationLevel.ERROR,
|
||||
replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image")
|
||||
replaceWith = ReplaceWith("Image", "Image")
|
||||
)
|
||||
@Suppress("EXPOSED_SUPER_INTERFACE")
|
||||
public interface OnlineImage : Image, ConstOriginUrlAware {
|
||||
@ -69,7 +69,7 @@ public interface OnlineImage : Image, ConstOriginUrlAware {
|
||||
@Deprecated(
|
||||
ONLINE_OFFLINE_DEPRECATION_MESSAGE,
|
||||
level = DeprecationLevel.ERROR,
|
||||
replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image")
|
||||
replaceWith = ReplaceWith("Image", "Image")
|
||||
)
|
||||
public interface OfflineImage : Image {
|
||||
public companion object Key : Message.Key<OfflineImage> {
|
||||
@ -96,7 +96,7 @@ public suspend fun OfflineImage.queryUrl(): String {
|
||||
@Deprecated(
|
||||
ONLINE_OFFLINE_DEPRECATION_MESSAGE,
|
||||
level = DeprecationLevel.ERROR,
|
||||
replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image")
|
||||
replaceWith = ReplaceWith("Image", "Image")
|
||||
)
|
||||
@Serializable
|
||||
public data class OfflineGroupImage(
|
||||
@ -124,7 +124,7 @@ public data class OfflineGroupImage(
|
||||
@Deprecated(
|
||||
ONLINE_OFFLINE_DEPRECATION_MESSAGE,
|
||||
level = DeprecationLevel.ERROR,
|
||||
replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image")
|
||||
replaceWith = ReplaceWith("Image", "Image")
|
||||
)
|
||||
public abstract class OnlineGroupImage : GroupImage(), OnlineImage
|
||||
|
||||
@ -137,7 +137,7 @@ public abstract class OnlineGroupImage : GroupImage(), OnlineImage
|
||||
@Deprecated(
|
||||
ONLINE_OFFLINE_DEPRECATION_MESSAGE,
|
||||
level = DeprecationLevel.ERROR,
|
||||
replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image")
|
||||
replaceWith = ReplaceWith("Image", "Image")
|
||||
)
|
||||
@Serializable
|
||||
public data class OfflineFriendImage(
|
||||
@ -161,7 +161,7 @@ public data class OfflineFriendImage(
|
||||
@Deprecated(
|
||||
ONLINE_OFFLINE_DEPRECATION_MESSAGE,
|
||||
level = DeprecationLevel.ERROR,
|
||||
replaceWith = ReplaceWith("Image", "net.mamoe.mirai.message.data.Image")
|
||||
replaceWith = ReplaceWith("Image", "Image")
|
||||
)
|
||||
public abstract class OnlineFriendImage : FriendImage(), OnlineImage
|
||||
|
@ -23,9 +23,9 @@ import net.mamoe.mirai.Bot
|
||||
import net.mamoe.mirai.contact.*
|
||||
import net.mamoe.mirai.event.AbstractEvent
|
||||
import net.mamoe.mirai.event.events.BotEvent
|
||||
import net.mamoe.mirai.internal.network.Packet
|
||||
import net.mamoe.mirai.message.data.MessageChain
|
||||
import net.mamoe.mirai.message.data.OnlineMessageSource
|
||||
import net.mamoe.mirai.qqandroid.network.Packet
|
||||
import kotlin.jvm.JvmMultifileClass
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
@ -35,7 +35,7 @@ import kotlin.jvm.JvmName
|
||||
*/
|
||||
@Deprecated(
|
||||
message = "use MessageEvent",
|
||||
replaceWith = ReplaceWith("MessageEvent", "net.mamoe.mirai.message.MessageEvent"),
|
||||
replaceWith = ReplaceWith("MessageEvent", "MessageEvent"),
|
||||
level = DeprecationLevel.HIDDEN
|
||||
)
|
||||
public abstract class MessagePacketBase<out TSender : User, out TSubject : Contact> : Packet, BotEvent,
|
||||
@ -51,7 +51,7 @@ public abstract class MessagePacketBase<out TSender : User, out TSubject : Conta
|
||||
|
||||
@Deprecated(
|
||||
message = "Ambiguous name. Use MessageEvent instead",
|
||||
replaceWith = ReplaceWith("MessageEvent", "net.mamoe.mirai.message.MessageEvent"),
|
||||
replaceWith = ReplaceWith("MessageEvent", "MessageEvent"),
|
||||
level = DeprecationLevel.HIDDEN
|
||||
)
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
@ -68,7 +68,7 @@ public abstract class MessagePacket : MessagePacketBase<User, Contact>(),
|
||||
|
||||
@Deprecated(
|
||||
message = "Ambiguous name. Use MessageEvent instead",
|
||||
replaceWith = ReplaceWith("MessageEvent", "net.mamoe.mirai.message.MessageEvent"),
|
||||
replaceWith = ReplaceWith("MessageEvent", "MessageEvent"),
|
||||
level = DeprecationLevel.HIDDEN
|
||||
)
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
@ -85,7 +85,7 @@ public abstract class ContactMessage : MessagePacket(),
|
||||
|
||||
@Deprecated(
|
||||
message = "Ambiguous name. Use FriendMessageEvent instead",
|
||||
replaceWith = ReplaceWith("FriendMessageEvent", "net.mamoe.mirai.message.FriendMessageEvent"),
|
||||
replaceWith = ReplaceWith("FriendMessageEvent", "FriendMessageEvent"),
|
||||
level = DeprecationLevel.HIDDEN
|
||||
)
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
@ -101,7 +101,7 @@ public abstract class FriendMessage : MessageEvent() {
|
||||
|
||||
@Deprecated(
|
||||
message = "Ambiguous name. Use GroupMessageEvent instead",
|
||||
replaceWith = ReplaceWith("GroupMessageEvent", "net.mamoe.mirai.message.GroupMessageEvent"),
|
||||
replaceWith = ReplaceWith("GroupMessageEvent", "GroupMessageEvent"),
|
||||
level = DeprecationLevel.HIDDEN
|
||||
)
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
@ -118,7 +118,7 @@ public abstract class GroupMessage : MessageEvent() {
|
||||
|
||||
@Deprecated(
|
||||
message = "Ambiguous name. Use TempMessageEvent instead",
|
||||
replaceWith = ReplaceWith("TempMessageEvent", "net.mamoe.mirai.message.TempMessageEvent"),
|
||||
replaceWith = ReplaceWith("TempMessageEvent", "TempMessageEvent"),
|
||||
level = DeprecationLevel.HIDDEN
|
||||
)
|
||||
public abstract class TempMessage : MessageEvent() {
|
@ -7,7 +7,7 @@
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
package net.mamoe.mirai.qqandroid.network
|
||||
package net.mamoe.mirai.internal.network
|
||||
|
||||
import net.mamoe.mirai.event.Event
|
||||
import net.mamoe.mirai.utils.MiraiInternalAPI
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user