Detects `String + Message` calls. `String + Message` is essentially `String + Message.toString()` and is different
15 | from `Message + Message`. Such conversions are implicit and may lead to confusing behavior.
16 |
17 |
--------------------------------------------------------------------------------
/mirai-console/tools/intellij-plugin/resources/messages/InspectionGadgetsBundle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2021 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 | plugin.service.not.configured.display.name=Plugin main not configured
10 | using.string.plus.message.display.name=Using string plus message
11 | resource.not.closed.display.name=Resource not closed
--------------------------------------------------------------------------------
/mirai-console/tools/intellij-plugin/resources/messages/InspectionsBundle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2021 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 | group.names.plugin.service.issues=Plugin service issues
10 | group.names.message.issues=Message issues
11 | group.names.mirai.core.issues=Mirai core issues
--------------------------------------------------------------------------------
/mirai-console/tools/intellij-plugin/run/projects/.gitignore:
--------------------------------------------------------------------------------
1 | local.properties
2 | build/
3 | build
4 | .gradle
5 | .idea
6 |
--------------------------------------------------------------------------------
/mirai-console/tools/intellij-plugin/run/projects/test-project/build.gradle.kts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | plugins {
11 | kotlin("jvm") version "1.8.20"
12 | kotlin("plugin.serialization") version "1.8.20"
13 | id("net.mamoe.mirai-console") version "2.99.0-local"
14 | java
15 | }
16 |
17 | group = "org.example"
18 | version = "1.0-SNAPSHOT"
19 |
20 | dependencies {
21 |
22 | }
23 |
24 | repositories {
25 | mavenCentral()
26 | mavenLocal()
27 | }
--------------------------------------------------------------------------------
/mirai-console/tools/intellij-plugin/run/projects/test-project/gradle.properties:
--------------------------------------------------------------------------------
1 | kotlin.code.style=official
2 |
--------------------------------------------------------------------------------
/mirai-console/tools/intellij-plugin/run/projects/test-project/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mamoe/mirai/283f8840d4682cc30fbdd87c66fe76f6a71ff8db/mirai-console/tools/intellij-plugin/run/projects/test-project/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/mirai-console/tools/intellij-plugin/run/projects/test-project/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2023 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 |
10 | distributionBase=GRADLE_USER_HOME
11 | distributionPath=wrapper/dists
12 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
13 | zipStoreBase=GRADLE_USER_HOME
14 | zipStorePath=wrapper/dists
15 |
--------------------------------------------------------------------------------
/mirai-console/tools/intellij-plugin/run/projects/test-project/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | rootProject.name = "test-project"
2 |
3 | pluginManagement {
4 | repositories {
5 | mavenLocal()
6 | gradlePluginPortal()
7 | jcenter()
8 | }
9 | }
--------------------------------------------------------------------------------
/mirai-console/tools/intellij-plugin/run/projects/test-project/src/main/kotlin/org/example/myplugin/AbstractMessageKeysUsages.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package org.example.myplugin
11 |
12 | import net.mamoe.mirai.message.data.MessageContent
13 | import net.mamoe.mirai.message.data.messageChainOf
14 |
15 | fun main() {
16 | val chain = messageChainOf()
17 | chain[MessageContent]
18 | }
--------------------------------------------------------------------------------
/mirai-console/tools/intellij-plugin/run/projects/test-project/src/main/kotlin/org/example/myplugin/ConsoleCommandOwnerCheck.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 | package org.example.myplugin
11 |
12 | import net.mamoe.mirai.console.command.ConsoleCommandOwner
13 | import net.mamoe.mirai.console.command.SimpleCommand
14 |
15 |
16 | object MySimpleCommand0002 : SimpleCommand(
17 | ConsoleCommandOwner, "foo",
18 | description = "示例指令"
19 | ) {}
20 |
--------------------------------------------------------------------------------
/mirai-console/tools/intellij-plugin/run/projects/test-project/src/main/kotlin/org/example/myplugin/WrapWithResourceUseCallIntentionTest.kt:
--------------------------------------------------------------------------------
1 | package org.example.myplugin
2 |
3 | import net.mamoe.mirai.contact.Contact
4 | import net.mamoe.mirai.utils.ExternalResource
5 | import net.mamoe.mirai.utils.ExternalResource.Companion.sendAsImageTo
6 | import java.io.File
7 |
8 | class WrapWithResourceUseCallIntentionTest {
9 | suspend fun test() {
10 |
11 | val file = magic()
12 | val contact = magic()
13 | val resource = magic()
14 |
15 | resource.sendAsImageTo(contact)
16 | resource.run { sendAsImageTo(contact) }
17 | }
18 | }
--------------------------------------------------------------------------------
/mirai-console/tools/intellij-plugin/run/projects/test-project/src/test/kotlin/RunConsole.kt:
--------------------------------------------------------------------------------
1 | import net.mamoe.mirai.alsoLogin
2 | import net.mamoe.mirai.console.MiraiConsole
3 | import net.mamoe.mirai.console.plugin.PluginManager.INSTANCE.enable
4 | import net.mamoe.mirai.console.plugin.PluginManager.INSTANCE.load
5 | import net.mamoe.mirai.console.terminal.MiraiConsoleTerminalLoader
6 | import org.example.myplugin.MyPluginMain
7 |
8 | suspend fun main() {
9 | MiraiConsoleTerminalLoader.startAsDaemon()
10 |
11 | MyPluginMain.load() // 主动加载插件, Console 会调用 MyPluginMain.onLoad
12 | MyPluginMain.enable() // 主动启用插件, Console 会调用 MyPluginMain.onEnable
13 |
14 | val bot = MiraiConsole.addBot(123456, "").alsoLogin() // 登录一个测试环境的 Bot
15 |
16 | MiraiConsole.job.join()
17 | }
--------------------------------------------------------------------------------
/mirai-console/tools/intellij-plugin/test/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 |
11 | package net.mamoe.mirai.console.intellij
--------------------------------------------------------------------------------
/mirai-core-api/src/androidMain/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/mirai-core-api/src/androidMain/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai
--------------------------------------------------------------------------------
/mirai-core-api/src/androidMain/kotlin/utils/LoginSolver.android.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 |
11 | package net.mamoe.mirai.utils
12 |
13 | internal actual object PlatformLoginSolverImplementations {
14 | actual val isSliderCaptchaSupported: Boolean by lazy { System.getProperty("mirai.slider.captcha.supported") != null }
15 | actual val default: LoginSolver? get() = null
16 | }
17 |
--------------------------------------------------------------------------------
/mirai-core-api/src/commonMain/kotlin/contact/TempUser.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.contact
11 |
12 | import net.mamoe.mirai.utils.MiraiInternalApi
13 | import net.mamoe.mirai.utils.NotStableForInheritance
14 |
15 | /**
16 | * 临时会话用户, 非群成员.
17 | *
18 | * [#429](https://github.com/mamoe/mirai/issues/429)
19 | */
20 | @MiraiInternalApi("其他渠道的临时会话暂未支持. ")
21 | @NotStableForInheritance
22 | public interface TempUser : User
--------------------------------------------------------------------------------
/mirai-core-api/src/commonMain/kotlin/data/UserInfo.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.data
11 |
12 | import net.mamoe.mirai.LowLevelApi
13 |
14 | @LowLevelApi
15 | public interface UserInfo {
16 | public val uin: Long
17 |
18 | public val nick: String
19 |
20 | public val remark: String
21 | }
22 |
--------------------------------------------------------------------------------
/mirai-core-api/src/commonMain/kotlin/event/events/EventCancelledException.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.event.events
11 |
12 | @Suppress("unused")
13 | public class EventCancelledException : RuntimeException {
14 | public constructor() : super()
15 | public constructor(message: String?) : super(message)
16 | public constructor(message: String?, cause: Throwable?) : super(message, cause)
17 | public constructor(cause: Throwable?) : super(cause)
18 | }
19 |
--------------------------------------------------------------------------------
/mirai-core-api/src/commonMain/kotlin/internal/event/VerboseEvent.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.event
11 |
12 | import net.mamoe.mirai.utils.MiraiInternalApi
13 |
14 | /**
15 | * 标记一个事件过于冗长, 默认不显示
16 | */
17 | @MiraiInternalApi
18 | public interface VerboseEvent // May be public?
19 |
--------------------------------------------------------------------------------
/mirai-core-api/src/commonMain/kotlin/internal/utils/Marker.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.utils
11 |
12 | import org.apache.logging.log4j.MarkerManager
13 |
14 | internal typealias Marker = org.apache.logging.log4j.Marker
15 |
16 | internal object MarkerManager {
17 | fun getMarker(name: String): Marker {
18 | return MarkerManager.getMarker(name)
19 | }
20 | }
--------------------------------------------------------------------------------
/mirai-core-api/src/commonMain/kotlin/message/data/README.md:
--------------------------------------------------------------------------------
1 | # mirai Message
2 | 消息对象. 查看 [Message] 源码内注释
3 |
4 | [Message]: Message.kt#L35
5 |
--------------------------------------------------------------------------------
/mirai-core-api/src/commonMain/kotlin/utils/OverFileSizeMaxException.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | @file:JvmMultifileClass
11 | @file:JvmName("Utils")
12 |
13 | package net.mamoe.mirai.utils
14 |
15 | import kotlin.jvm.JvmMultifileClass
16 | import kotlin.jvm.JvmName
17 |
18 | /**
19 | * 图片文件过大
20 | */ // 不要删除多平台结构, 这是 kotlin 的 bug
21 | public class OverFileSizeMaxException : IllegalStateException()
--------------------------------------------------------------------------------
/mirai-core-api/src/commonTest/kotlin/logging/AbstractLoggingTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.logging
11 |
12 | import net.mamoe.mirai.utils.MiraiLoggerFactoryImplementationBridge
13 | import org.junit.jupiter.api.AfterEach
14 |
15 | internal abstract class AbstractLoggingTest {
16 | @AfterEach
17 | fun cleanup() {
18 | MiraiLoggerFactoryImplementationBridge.run { setInstance(createPlatformInstance()) }
19 | }
20 | }
--------------------------------------------------------------------------------
/mirai-core-api/src/commonTest/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2020 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 | package net.mamoe.mirai
--------------------------------------------------------------------------------
/mirai-core-api/src/commonTest/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2021 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 | log4j.rootLogger=INFO,stdout
10 | log4j.logger.mirai=INFO
11 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender
12 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
13 | log4j.appender.stdout.layout.ConversionPattern=%p\t%d{ISO8601}\t%r\t%c\t%m%n
--------------------------------------------------------------------------------
/mirai-core-api/src/jvmMain/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai
--------------------------------------------------------------------------------
/mirai-core-api/src/jvmMain/resources/net/mamoe/mirai/utils/project-mirai.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mamoe/mirai/283f8840d4682cc30fbdd87c66fe76f6a71ff8db/mirai-core-api/src/jvmMain/resources/net/mamoe/mirai/utils/project-mirai.png
--------------------------------------------------------------------------------
/mirai-core-api/src/jvmTest/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2020 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai
--------------------------------------------------------------------------------
/mirai-core-mock/README.md:
--------------------------------------------------------------------------------
1 | # mirai-core-mock
2 |
3 | mirai 模拟环境测试框架
4 |
5 | > 模拟环境目前仅支持 JVM
6 |
7 | --------------
8 |
9 | # src 架构
10 |
11 | - `contact` - 与 `mirai-core-api` 架构一致
12 | - `database` - 数据库, 用于存储一些临时的零碎数据
13 | - `resserver` - 资源服务
14 | - `userprofile` - 与 `UserProfile` 相关的一些服务
15 | - `utils` - 工具类
16 |
17 | # test 架构
18 |
19 | - `` 与 mirai-core-api 关系不大或者一些独立的组件的测试
20 | - `.mock` 模拟的各个部分的测试, 每个测试都继承 `MockBotTestBase`
21 |
22 |
--------------------------------------------------------------------------------
/mirai-core-mock/src/MockBotDSL.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.mock
11 |
12 | @DslMarker
13 | public annotation class MockBotDSL
14 |
--------------------------------------------------------------------------------
/mirai-core-mock/src/contact/MockAnonymousMember.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.mock.contact
11 |
12 | import net.mamoe.mirai.contact.AnonymousMember
13 |
14 | public interface MockAnonymousMember : AnonymousMember, MockMember
15 |
--------------------------------------------------------------------------------
/mirai-core-mock/src/contact/MockContactOrBot.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.mock.contact
11 |
12 | import net.mamoe.mirai.contact.ContactOrBot
13 | import net.mamoe.mirai.mock.MockBot
14 |
15 | public interface MockContactOrBot : ContactOrBot {
16 | override val bot: MockBot
17 | }
--------------------------------------------------------------------------------
/mirai-core-mock/src/contact/MockMsgSyncSupport.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.mock.contact
11 |
12 | import net.mamoe.mirai.contact.OtherClient
13 | import net.mamoe.mirai.message.data.MessageChain
14 | import net.mamoe.mirai.mock.MockBotDSL
15 |
16 | public interface MockMsgSyncSupport : MockContact {
17 | /**
18 | * 广播消息同步事件
19 | */
20 | @MockBotDSL
21 | public suspend fun broadcastMsgSyncEvent(client: OtherClient, message: MessageChain, time: Int)
22 | }
--------------------------------------------------------------------------------
/mirai-core-mock/src/contact/MockOtherClient.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.mock.contact
11 |
12 | import net.mamoe.mirai.contact.OtherClient
13 |
14 | public interface MockOtherClient : OtherClient, MockContact
15 |
--------------------------------------------------------------------------------
/mirai-core-mock/src/contact/MockUserOrBot.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
11 |
12 | package net.mamoe.mirai.mock.contact
13 |
14 | import me.him188.kotlin.jvm.blocking.bridge.JvmBlockingBridge
15 | import net.mamoe.mirai.contact.UserOrBot
16 |
17 | @JvmBlockingBridge
18 | public interface MockUserOrBot : MockContactOrBot, UserOrBot
--------------------------------------------------------------------------------
/mirai-core-mock/src/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.mock
11 |
12 |
--------------------------------------------------------------------------------
/mirai-core-mock/src/resserver/MockServerFileSystem.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.mock.resserver
11 |
12 | public interface MockServerFileSystem {
13 | public val disk: MockServerFileDisk
14 | public val root: MockServerRemoteFile
15 | public fun resolveById(id: String): MockServerRemoteFile?
16 | public fun findByPath(path: String): Sequence
17 | }
18 |
--------------------------------------------------------------------------------
/mirai-core-mock/src/utils/AvatarGenerator.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.mock.utils
11 |
12 | /**
13 | * 头像生成器
14 | *
15 | * @since 2.14.0
16 | */
17 | public interface AvatarGenerator {
18 | public fun generateAvatarForPerson(id: Long): ByteArray = generateRandomAvatar()
19 | public fun generateAvatarForGroup(id: Long): ByteArray = generateRandomAvatar()
20 |
21 | public fun generateRandomAvatar(): ByteArray
22 | }
23 |
--------------------------------------------------------------------------------
/mirai-core-mock/src/utils/event.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.mock.utils
11 |
12 | import kotlinx.coroutines.runBlocking
13 | import net.mamoe.mirai.event.Event
14 | import net.mamoe.mirai.event.broadcast
15 |
16 |
17 | public fun T.broadcastBlocking(): T = apply {
18 | runBlocking { broadcast() }
19 | }
20 |
--------------------------------------------------------------------------------
/mirai-core-mock/src/utils/http.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | @file:JvmMultifileClass
11 | @file:JvmName("MiraiUtils")
12 | @file:Suppress("NOTHING_TO_INLINE")
13 |
14 | package net.mamoe.mirai.mock.utils
15 |
16 | import kotlin.jvm.JvmMultifileClass
17 | import kotlin.jvm.JvmName
18 |
19 | public fun String.plusHttpSubpath(subpath: String): String {
20 |
21 | if (this[this.lastIndex] == '/') return this + subpath
22 |
23 | return "$this/$subpath"
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/mirai-core-mock/src/utils/mockdsl.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
11 |
12 | package net.mamoe.mirai.mock.utils
13 |
14 | @DslMarker
15 | public annotation class MockActionsDsl
16 |
--------------------------------------------------------------------------------
/mirai-core-mock/test/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.mock.test
11 |
--------------------------------------------------------------------------------
/mirai-core-utils/README.md:
--------------------------------------------------------------------------------
1 | # mirai-core-utils
2 |
3 | 内部工具类模块。提供二进制兼容而不提供源码兼容,但也不保证破坏性变更不会发生,因此若要使用该工具模块,请自行承担兼容后果。
--------------------------------------------------------------------------------
/mirai-core-utils/src/androidMain/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/mirai-core-utils/src/commonMain/kotlin/Base64.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.utils
11 |
12 | public expect fun ByteArray.encodeBase64(): String
13 | public expect fun String.decodeBase64(): ByteArray
14 |
--------------------------------------------------------------------------------
/mirai-core-utils/src/commonMain/kotlin/annotations/Range.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.utils.annotations
11 |
12 | @OptIn(ExperimentalMultiplatform::class)
13 | @Target(AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.PROPERTY, AnnotationTarget.TYPE)
14 | @Retention(AnnotationRetention.BINARY)
15 | @OptionalExpectation
16 | public expect annotation class Range(val from: Long, val to: Long)
--------------------------------------------------------------------------------
/mirai-core-utils/src/commonMain/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.utils
--------------------------------------------------------------------------------
/mirai-core-utils/src/jvmBaseMain/kotlin/Clock.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.utils
11 |
12 | public actual inline fun measureTimeMillis(block: () -> Unit): Long = kotlin.system.measureTimeMillis(block)
--------------------------------------------------------------------------------
/mirai-core-utils/src/jvmBaseMain/kotlin/ConcurrentLinkedQueue.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.utils
11 |
12 |
13 | @Suppress("FunctionName")
14 | public actual fun ConcurrentLinkedDeque(): MutableDeque {
15 | return java.util.concurrent.ConcurrentLinkedDeque()
16 | }
--------------------------------------------------------------------------------
/mirai-core-utils/src/jvmBaseMain/kotlin/Reflections.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.utils
11 |
12 | import kotlin.reflect.KClass
13 | import kotlin.reflect.KParameter
14 |
15 | public fun KClass.createInstanceOrNull(): T? {
16 | objectInstance?.let { return it }
17 | val noArgsConstructor = constructors.singleOrNull { it.parameters.all(KParameter::isOptional) }
18 | ?: return null
19 |
20 | return noArgsConstructor.callBy(emptyMap())
21 | }
22 |
--------------------------------------------------------------------------------
/mirai-core-utils/src/jvmBaseMain/kotlin/Resources.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.utils
11 |
12 |
13 | @TestOnly
14 | public fun readResource(url: String): String =
15 | Thread.currentThread().contextClassLoader?.getResourceAsStream(url)?.readBytes()?.decodeToString()
16 | ?: error("Could not find resource '$url'")
17 |
--------------------------------------------------------------------------------
/mirai-core-utils/src/jvmBaseMain/kotlin/Serialization.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.utils
11 |
12 | import kotlinx.serialization.BinaryFormat
13 | import kotlinx.serialization.DeserializationStrategy
14 | import kotlinx.serialization.StringFormat
15 | import java.io.File
16 |
17 |
--------------------------------------------------------------------------------
/mirai-core-utils/src/jvmBaseMain/kotlin/StructureToStringTransformer.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.utils
11 |
12 | internal actual fun getPlatformDefaultStructureToStringTransformer(): StructureToStringTransformer? {
13 | return StructureToStringTransformerLegacy()
14 | }
--------------------------------------------------------------------------------
/mirai-core-utils/src/jvmBaseMain/kotlin/annotations/Range.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.utils.annotations
11 |
12 |
13 | public actual typealias Range = org.jetbrains.annotations.Range
--------------------------------------------------------------------------------
/mirai-core-utils/src/jvmBaseMain/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 | package net.mamoe.mirai.utils
10 |
--------------------------------------------------------------------------------
/mirai-core-utils/src/jvmBaseMain/kotlin/systemProp.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.utils
11 |
12 | internal actual fun getProperty(name: String, default: String): String? = System.getProperty(name, default)
13 |
14 | internal actual fun setProperty(name: String, value: String) {
15 | System.setProperty(name, value)
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/mirai-core-utils/src/jvmBaseTest/kotlin/ByteArrayOpTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.utils
11 |
12 | internal actual class ByteArrayOpTest : CommonByteArrayOpTest()
--------------------------------------------------------------------------------
/mirai-core-utils/src/jvmBaseTest/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.utils
--------------------------------------------------------------------------------
/mirai-core/.gitignore:
--------------------------------------------------------------------------------
1 | src/jvmTest/kotlin/local
2 | test-sandbox/
--------------------------------------------------------------------------------
/mirai-core/compatibility-validation/android/api/android.api:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mamoe/mirai/283f8840d4682cc30fbdd87c66fe76f6a71ff8db/mirai-core/compatibility-validation/android/api/android.api
--------------------------------------------------------------------------------
/mirai-core/compatibility-validation/jvm/api/jvm.api:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mamoe/mirai/283f8840d4682cc30fbdd87c66fe76f6a71ff8db/mirai-core/compatibility-validation/jvm/api/jvm.api
--------------------------------------------------------------------------------
/mirai-core/src/androidInstrumentedTest/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal
--------------------------------------------------------------------------------
/mirai-core/src/androidInstrumentedTest/kotlin/test/initializeTestJvm.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.test
11 |
12 | internal actual fun initializeTestPlatformBeforeCommon() {
13 | // nop
14 | }
--------------------------------------------------------------------------------
/mirai-core/src/androidInstrumentedTest/kotlin/testFramework/currentPlatform.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.testFramework
11 |
12 | actual fun currentPlatform(): Platform = Platform.AndroidInstrumentedTest
--------------------------------------------------------------------------------
/mirai-core/src/androidMain/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/mirai-core/src/androidMain/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal
--------------------------------------------------------------------------------
/mirai-core/src/androidUnitTest/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 |
11 | package net.mamoe.mirai.internal
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/contact/ContactAware.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.contact
11 |
12 | import net.mamoe.mirai.contact.Contact
13 | import net.mamoe.mirai.internal.asQQAndroidBot
14 |
15 | internal interface ContactAware {
16 | val contact: Contact
17 |
18 | val bot get() = contact.bot.asQQAndroidBot()
19 | val client get() = bot.client
20 | }
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/contact/SendMessageHandler.kt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mamoe/mirai/283f8840d4682cc30fbdd87c66fe76f6a71ff8db/mirai-core/src/commonMain/kotlin/contact/SendMessageHandler.kt
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/contact/info/FriendGroupInfo.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.contact.info
11 |
12 | import kotlinx.serialization.Serializable
13 |
14 | @Serializable
15 | internal data class FriendGroupInfo(
16 | val groupId: Int,
17 | var groupName: String,
18 | // val friendCount: Int,
19 | // val onlineFriendCount: Int
20 | )
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/event/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.event
11 |
12 |
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/message/atImpl.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 |
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/message/faceImpl.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 |
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/message/image/jceData.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.message.image
11 |
12 | import net.mamoe.mirai.message.data.Image
13 | import net.mamoe.mirai.utils.toUHexString
14 |
15 |
16 | internal val Image.friendImageId: String
17 | get() {
18 | // /1234567890-3666252994-EFF4427CE3D27DB6B1D9A8AB72E7A29C
19 | return "/000000000-000000000-${md5.toUHexString("")}"
20 | }
21 |
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/message/imagesImpl.kt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mamoe/mirai/283f8840d4682cc30fbdd87c66fe76f6a71ff8db/mirai-core/src/commonMain/kotlin/message/imagesImpl.kt
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/message/messageToElems.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.message
11 |
12 | import net.mamoe.mirai.message.data.PlainText
13 |
14 |
15 | internal val UNSUPPORTED_VOICE_MESSAGE_PLAIN = PlainText("收到语音消息,你需要升级到最新版QQ才能接收,升级地址https://im.qq.com")
16 |
17 |
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/message/rich/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.message.rich
11 |
12 |
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/network/DebuggingProperties.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network
11 |
12 | internal object DebuggingProperties {
13 | const val SHOW_TLV_MAP_ON_LOGIN_SUCCESS = false
14 | }
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/network/components/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 | /**
11 | * 放置一些小组件
12 | */
13 | package net.mamoe.mirai.internal.network.components
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/network/handler/selector/ExceptionInSelectorResumeException.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.handler.selector
11 |
12 | internal class ExceptionInSelectorResumeException(
13 | cause: Throwable,
14 | ) : RuntimeException(cause)
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/network/handler/selector/MaxAttemptsReachedException.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.handler.selector
11 |
12 | internal data class MaxAttemptsReachedException(
13 | override val cause: Throwable?,
14 | ) : IllegalStateException("Failed to resume instance. Maximum attempts reached.") {
15 | override fun toString(): String {
16 | return "MaxAttemptsReachedException"
17 | }
18 | }
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/network/handler/selector/NetworkChannelException.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.handler.selector
11 |
12 | internal open class NetworkChannelException : NetworkException {
13 | constructor() : super(true)
14 | constructor(cause: Throwable?) : super(true, cause)
15 | constructor(message: String) : super(message, true)
16 | constructor(message: String, cause: Throwable?) : super(message, cause, true)
17 | }
18 |
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/network/handler/selector/NoServerAvailableException.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.handler.selector
11 |
12 | internal class NoServerAvailableException :
13 | NoSuchElementException("No server available. (Failed to connect to any of the servers)")
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/network/handler/selector/PacketTimeoutException.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.handler.selector
11 |
12 | internal data class PacketTimeoutException(
13 | override val message: String,
14 | override val cause: Throwable? = null,
15 | ) : NetworkException(true)
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/network/handler/selector/SelectorRequireReconnectException.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.handler.selector
11 |
12 | /**
13 | * A special exception that instructs selector to restart network connection
14 | */
15 | internal expect class SelectorRequireReconnectException() : NetworkException
16 |
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/network/handler/state/ExceptionInStateObserverException.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.handler.state
11 |
12 | internal class ExceptionInStateObserverException(
13 | override val cause: Throwable,
14 | ) : RuntimeException()
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/network/impl/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.impl
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/network/protocol/data/proto/ImgExtPbResvAttrCommon.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.protocol.data.proto
11 |
12 | import net.mamoe.mirai.internal.utils.io.ProtoBuf
13 |
14 | internal interface ImgExtPbResvAttrCommon: ProtoBuf {
15 | val textSummary: ByteArray
16 | val imageBizType: Int
17 | }
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/network/protocol/packet/chat/SendMessageMultiProtocol.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2020 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.protocol.packet.chat
11 |
12 |
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/utils/ExternalResourceImpl.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.utils
11 |
12 | import net.mamoe.mirai.utils.ExternalResource
13 |
14 | @Suppress("FunctionName")
15 | internal expect fun CombinedExternalResource(vararg resources: ExternalResource): ExternalResource
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/utils/MiraiUtilsLogger.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | @file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
11 |
12 | package net.mamoe.mirai.internal.utils
13 |
14 | import net.mamoe.mirai.utils.MiraiLogger
15 | import net.mamoe.mirai.utils.UtilsLogger
16 | import net.mamoe.mirai.utils.asUtilsLogger as asUtilsLogger1
17 |
18 | internal fun MiraiLogger.asUtilsLogger(): UtilsLogger = asUtilsLogger1()
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/kotlin/utils/crypto/AES.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.utils.crypto
11 |
12 | internal expect fun aesEncrypt(input: ByteArray, iv: ByteArray, key: ByteArray): ByteArray
13 |
14 | internal expect fun aesDecrypt(input: ByteArray, iv: ByteArray, key: ByteArray): ByteArray
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/resources/META-INF/services/net.mamoe.mirai.IMirai:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2021 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 |
10 | net.mamoe.mirai.internal.MiraiImpl
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/resources/META-INF/services/net.mamoe.mirai.auth.DefaultBotAuthorizationFactory:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2023 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 |
10 | net.mamoe.mirai.internal.network.auth.DefaultBotAuthorizationFactoryImpl
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/resources/META-INF/services/net.mamoe.mirai.event.InternalGlobalEventChannelProvider:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2022 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 |
10 | net.mamoe.mirai.internal.event.GlobalEventChannelProviderImpl
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/resources/META-INF/services/net.mamoe.mirai.message.data.InternalImageProtocol:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2022 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 |
10 | net.mamoe.mirai.internal.message.image.InternalImageProtocolImpl
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/resources/META-INF/services/net.mamoe.mirai.message.data.InternalShortVideoProtocol:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2022 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 |
10 | net.mamoe.mirai.internal.message.image.InternalShortVideoProtocolImpl
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/resources/META-INF/services/net.mamoe.mirai.message.data.OfflineAudio$Factory:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2022 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 |
10 | net.mamoe.mirai.internal.message.data.OfflineAudioFactoryImpl
--------------------------------------------------------------------------------
/mirai-core/src/commonMain/resources/META-INF/services/net.mamoe.mirai.utils.InternalProtocolDataExchange:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2023 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 |
10 | net.mamoe.mirai.internal.utils.MiraiProtocolInternal$Exchange
11 |
--------------------------------------------------------------------------------
/mirai-core/src/commonTest/kotlin/event/AbstractEventTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.event
11 |
12 | import net.mamoe.mirai.internal.test.AbstractTest
13 |
14 | internal abstract class AbstractEventTest : AbstractTest() {
15 | init {
16 | // System.setProperty("mirai.event.trace", "true") // Do not set it to true by default, or the concurrency stress test will become extremely slow.
17 | }
18 | }
--------------------------------------------------------------------------------
/mirai-core/src/commonTest/kotlin/message/serialization/AbstractMessageSerializationTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.message.serialization
11 |
12 | import net.mamoe.mirai.internal.test.AbstractTest
13 |
14 | internal abstract class AbstractMessageSerializationTest : AbstractTest()
--------------------------------------------------------------------------------
/mirai-core/src/commonTest/kotlin/network/PacketCodecTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network
11 |
12 | import net.mamoe.mirai.internal.test.AbstractTest
13 |
14 | internal class PacketCodecTest : AbstractCodecTest()
15 |
16 | internal abstract class AbstractCodecTest : AbstractTest()
--------------------------------------------------------------------------------
/mirai-core/src/commonTest/kotlin/testFramework/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.testFramework
--------------------------------------------------------------------------------
/mirai-core/src/commonTest/resources/META-INF/services/net.mamoe.mirai.internal.message.source.MessageSourceSequenceIdAwaiter:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2022 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 |
10 | net.mamoe.mirai.internal.testFramework.message.TestMessageSourceSequenceIdAwaiter
--------------------------------------------------------------------------------
/mirai-core/src/commonTest/resources/image/jpeg-header-issue-1610.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mamoe/mirai/283f8840d4682cc30fbdd87c66fe76f6a71ff8db/mirai-core/src/commonTest/resources/image/jpeg-header-issue-1610.bin
--------------------------------------------------------------------------------
/mirai-core/src/commonTest/resources/recording/configs/desensitization.yml:
--------------------------------------------------------------------------------
1 | # Template for Desensitization in recordings
2 | #
3 | # Format:
4 | # ```
5 | # :
6 | # ```
7 | #
8 | # If key is a number, its group uin counterpart will also be processed, with calculated replacer.
9 | # WARNING: Ensure the is not longer than .
10 | #
11 | # For example, if your account id is 147258369, you may add:
12 | # ```
13 | # 147258369: 123456
14 | # ```
15 | # Then your id will be replaced with 123456.
16 | #
17 | #
18 | # To use desensitization, duplicate this file into name "local.desensitization.yml".
19 |
20 | 123456789: 111
--------------------------------------------------------------------------------
/mirai-core/src/commonTest/resources/recording/configs/test.desensitization.yml:
--------------------------------------------------------------------------------
1 | 123456789: 111
2 | 987654321: 222
--------------------------------------------------------------------------------
/mirai-core/src/jvmBaseMain/kotlin/message/protocol/impl/TextProtocol.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.message.protocol.impl
11 |
12 | internal actual fun getEmojiPatternResourceOrNull(): String? {
13 | return TextProtocol::class.java.classLoader?.getResourceAsStream("emoji-pattern.regex")
14 | ?.use { it.readBytes().decodeToString() }
15 | }
--------------------------------------------------------------------------------
/mirai-core/src/jvmBaseMain/kotlin/network/component/ComponentKey.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.component
11 |
12 | import kotlin.reflect.KTypeProjection
13 | import kotlin.reflect.full.allSupertypes
14 |
15 | internal actual fun ComponentKey<*>.getComponentTypeArgument(): KTypeProjection? {
16 | val thisType = this::class.allSupertypes.find { it.classifier == ComponentKey::class }
17 | return thisType?.arguments?.firstOrNull()
18 | }
--------------------------------------------------------------------------------
/mirai-core/src/jvmBaseMain/kotlin/network/impl/netty/NettyChannelException.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.impl.netty
11 |
12 | import net.mamoe.mirai.internal.network.handler.selector.NetworkChannelException
13 |
14 | internal data class NettyChannelException(
15 | override val message: String? = null,
16 | override val cause: Throwable? = null,
17 | ) : NetworkChannelException()
--------------------------------------------------------------------------------
/mirai-core/src/jvmBaseMain/kotlin/network/impl/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.impl
--------------------------------------------------------------------------------
/mirai-core/src/jvmBaseMain/kotlin/network/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network
--------------------------------------------------------------------------------
/mirai-core/src/jvmBaseMain/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal
--------------------------------------------------------------------------------
/mirai-core/src/jvmBaseMain/kotlin/utils/BotConfigurationExt.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.utils
11 |
12 | import net.mamoe.mirai.utils.BotConfiguration
13 |
14 | internal actual val BotConfiguration.workingDirPath: String
15 | get() = workingDir.absolutePath
16 |
17 | internal actual val BotConfiguration.cacheDirPath: String
18 | get() = cacheDir.path
--------------------------------------------------------------------------------
/mirai-core/src/jvmBaseTest/kotlin/network/framework/AbstractNettyNHTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.network.framework
11 |
12 | internal abstract class AbstractNettyNHTest : AbstractCommonNHTest() {
13 |
14 | }
--------------------------------------------------------------------------------
/mirai-core/src/jvmBaseTest/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal
--------------------------------------------------------------------------------
/mirai-core/src/jvmBaseTest/kotlin/test/NativeTestWrapper.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.test
11 |
12 |
--------------------------------------------------------------------------------
/mirai-core/src/jvmBaseTest/kotlin/testFramework/DebugProbes.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.testFramework
11 |
12 | import kotlinx.coroutines.ExperimentalCoroutinesApi
13 |
14 | @Suppress("ACTUAL_WITHOUT_EXPECT", "NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS")
15 | @OptIn(ExperimentalCoroutinesApi::class)
16 | actual typealias DebugProbes = kotlinx.coroutines.debug.DebugProbes
--------------------------------------------------------------------------------
/mirai-core/src/jvmBaseTest/kotlin/testFramework/codegen/visitor/ValueDescVisitorUnit.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.testFramework.codegen.visitor
11 |
12 | import net.mamoe.mirai.internal.testFramework.codegen.descriptors.ValueDesc
13 |
14 | interface ValueDescVisitorUnit : ValueDescVisitor {
15 | override fun visitValue(desc: ValueDesc, data: Nothing?) {
16 | }
17 | }
--------------------------------------------------------------------------------
/mirai-core/src/jvmBaseTest/resources/META-INF/services/net.mamoe.mirai.utils.StructureToStringTransformer:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2022 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 |
10 | net.mamoe.mirai.internal.utils.StructureToStringTransformerNew
--------------------------------------------------------------------------------
/mirai-core/src/jvmMain/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal
--------------------------------------------------------------------------------
/mirai-core/src/jvmTest/kotlin/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2020 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/master/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal
--------------------------------------------------------------------------------
/mirai-core/src/jvmTest/kotlin/test/initializeTestJvm.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.test
11 |
12 | internal actual fun initializeTestPlatformBeforeCommon() {
13 | // nop
14 | }
--------------------------------------------------------------------------------
/mirai-core/src/jvmTest/kotlin/testFramework/currentPlatform.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2023 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.internal.testFramework
11 |
12 | actual fun currentPlatform(): Platform = Platform.Jvm
--------------------------------------------------------------------------------
/mirai-core/src/jvmTest/resources/account.yml:
--------------------------------------------------------------------------------
1 | id: 123
2 | password: ""
--------------------------------------------------------------------------------
/mirai-deps-test/.gitignore:
--------------------------------------------------------------------------------
1 | test/BuildConfig.kt
--------------------------------------------------------------------------------
/mirai-deps-test/README.md:
--------------------------------------------------------------------------------
1 | # native-deps-test
2 |
3 | 测试 shadow relocation
--------------------------------------------------------------------------------
/mirai-deps-test/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright 2019-2022 Mamoe Technologies and contributors.
3 | #
4 | # 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | # Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | #
7 | # https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | #
9 |
10 |
--------------------------------------------------------------------------------
/mirai-deps-test/test/package.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2022 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.deps.test
--------------------------------------------------------------------------------
/mirai-dokka/.gitignore:
--------------------------------------------------------------------------------
1 | /pages
2 |
--------------------------------------------------------------------------------
/mirai-dokka/README.md:
--------------------------------------------------------------------------------
1 | # mirai-dokka
2 |
3 | 生成的文档会部署到 [project-mirai/mirai-doc](https://github.com/project-mirai/mirai-doc), 网页部署在 https://kdoc.mirai.mamoe.net/
4 |
--------------------------------------------------------------------------------
/mirai-dokka/src/Prepare.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2021 Mamoe Technologies and contributors.
3 | *
4 | * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
5 | * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
6 | *
7 | * https://github.com/mamoe/mirai/blob/dev/LICENSE
8 | */
9 |
10 | package net.mamoe.mirai.dokka
11 |
12 | fun main() {
13 | if (pages.resolve(".git").isDirectory) {
14 | return
15 | }
16 | exec("git", "clone", "https://github.com/project-mirai/mirai-doc.git", pages.absolutePath)
17 | }
18 |
--------------------------------------------------------------------------------