mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-13 20:02:57 +08:00
Update to mirai-core 2.0-M1
This commit is contained in:
parent
29f3c9c609
commit
e2fb094e0f
@ -217,7 +217,7 @@ public interface CommandSender : CoroutineScope, Permittee {
|
||||
*/
|
||||
@JvmStatic
|
||||
@JvmName("of")
|
||||
public fun Member.asTempCommandSender(): TempCommandSender = TempCommandSender(this)
|
||||
public fun NormalMember.asTempCommandSender(): TempCommandSender = TempCommandSender(this)
|
||||
|
||||
/**
|
||||
* 得到 [MemberCommandSender]
|
||||
@ -234,7 +234,7 @@ public interface CommandSender : CoroutineScope, Permittee {
|
||||
@JvmStatic
|
||||
@JvmName("of")
|
||||
public fun Member.asCommandSender(isTemp: Boolean): UserCommandSender {
|
||||
return if (isTemp) asTempCommandSender() else asMemberCommandSender()
|
||||
return if (isTemp && this is NormalMember) asTempCommandSender() else asMemberCommandSender()
|
||||
}
|
||||
|
||||
/**
|
||||
@ -253,7 +253,7 @@ public interface CommandSender : CoroutineScope, Permittee {
|
||||
@JvmName("of")
|
||||
public fun User.asCommandSender(isTemp: Boolean): UserCommandSender = when (this) {
|
||||
is Friend -> this.asCommandSender()
|
||||
is Member -> if (isTemp) TempCommandSender(this) else MemberCommandSender(this)
|
||||
is Member -> if (isTemp && this is NormalMember) TempCommandSender(this) else MemberCommandSender(this)
|
||||
else -> error("stub")
|
||||
}
|
||||
}
|
||||
@ -545,7 +545,7 @@ public open class MemberCommandSender internal constructor(
|
||||
* @see TempCommandSenderOnMessage 代表一个 [群员][Member] 主动在临时会话发送消息执行指令
|
||||
*/
|
||||
public open class TempCommandSender internal constructor(
|
||||
public final override val user: Member,
|
||||
public final override val user: NormalMember,
|
||||
) : AbstractUserCommandSender(),
|
||||
GroupAwareCommandSender,
|
||||
CoroutineScope by user.childScope("TempCommandSender") {
|
||||
@ -560,7 +560,11 @@ public open class TempCommandSender internal constructor(
|
||||
public override suspend fun sendMessage(message: String): MessageReceipt<Member> = sendMessage(PlainText(message))
|
||||
|
||||
@JvmBlockingBridge
|
||||
public override suspend fun sendMessage(message: Message): MessageReceipt<Member> = user.sendMessage(message)
|
||||
public override suspend fun sendMessage(message: Message): MessageReceipt<Member> {
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@OptIn(net.mamoe.mirai.utils.MemberDeprecatedApi::class)
|
||||
return user.sendMessage(message) // just throw this error
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@ -616,7 +620,7 @@ public class MemberCommandSenderOnMessage internal constructor(
|
||||
*/
|
||||
public class TempCommandSenderOnMessage internal constructor(
|
||||
public override val fromEvent: TempMessageEvent,
|
||||
) : TempCommandSender(fromEvent.sender),
|
||||
) : TempCommandSender(fromEvent.sender as NormalMember),
|
||||
CommandSenderOnMessage<TempMessageEvent>,
|
||||
MessageEventExtensions<User, Contact> by fromEvent {
|
||||
public override val subject: Member get() = fromEvent.subject
|
||||
|
@ -14,8 +14,8 @@ import java.time.Instant
|
||||
|
||||
internal object MiraiConsoleBuildConstants { // auto-filled on build (task :mirai-console:fillBuildConstants)
|
||||
@JvmStatic
|
||||
val buildDate: Instant = Instant.ofEpochSecond(1606789540)
|
||||
const val versionConst: String = "1.1.0"
|
||||
val buildDate: Instant = Instant.ofEpochSecond(1608309902)
|
||||
const val versionConst: String = "2.0-M1"
|
||||
|
||||
@JvmStatic
|
||||
val version: SemVersion = SemVersion(versionConst)
|
||||
|
@ -12,8 +12,8 @@
|
||||
import org.gradle.api.attributes.Attribute
|
||||
|
||||
object Versions {
|
||||
const val core = "2.0-M1-dev-3"
|
||||
const val console = "2.0-M1-dev-1"
|
||||
const val core = "2.0-M1"
|
||||
const val console = "2.0-M1"
|
||||
const val consoleGraphical = "0.0.7"
|
||||
const val consoleTerminal = console
|
||||
|
||||
@ -33,10 +33,10 @@ object Versions {
|
||||
|
||||
const val bintray = "1.8.5"
|
||||
|
||||
const val blockingBridge = "1.4.1"
|
||||
const val blockingBridge = "1.5.0"
|
||||
|
||||
@Suppress("SpellCheckingInspection")
|
||||
const val yamlkt = "0.7.4"
|
||||
const val yamlkt = "0.7.5"
|
||||
|
||||
const val intellijGradlePlugin = "0.4.16"
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ console 由后端和前端一起工作. 使用时必须选择一个前端.
|
||||
| 版本类型 | 版本号 |
|
||||
|:------:|:------------------------------:|
|
||||
| 稳定 | 1.1.0 |
|
||||
| 预览 | - |
|
||||
| 预览 | 2.0-M1 |
|
||||
| 开发 | [![Version]][Bintray Download] |
|
||||
|
||||
## 配置项目
|
||||
|
@ -29,18 +29,18 @@ import org.gradle.api.publish.maven.MavenPublication
|
||||
// must be open
|
||||
public open class MiraiConsoleExtension {
|
||||
/**
|
||||
* 为 `true` 时不自动添加 mirai-core 的依赖
|
||||
* 为 `true` 时不自动添加 mirai-core-api 的依赖
|
||||
*
|
||||
* 默认: `false`
|
||||
*/
|
||||
public var noCore: Boolean = false
|
||||
public var noCoreApi: Boolean = false
|
||||
|
||||
/**
|
||||
* 为 `true` 时不自动为 test 模块添加 mirai-core-qqandroid 的依赖.
|
||||
* 为 `true` 时不自动为 test 模块添加 mirai-core 的依赖.
|
||||
*
|
||||
* 默认: `false`
|
||||
*/
|
||||
public var noTestCoreQQAndroid: Boolean = false
|
||||
public var noTestCore: Boolean = false
|
||||
|
||||
/**
|
||||
* 为 `true` 时不自动添加 mirai-console 的依赖.
|
||||
@ -50,7 +50,7 @@ public open class MiraiConsoleExtension {
|
||||
public var noConsole: Boolean = false
|
||||
|
||||
/**
|
||||
* 自动添加的 mirai-core 和 mirai-core-qqandroid 的版本.
|
||||
* 自动添加的 mirai-core 和 mirai-core-api 的版本.
|
||||
*
|
||||
* 默认: 与本 Gradle 插件编译时的 mirai-core 版本相同. [VersionConstants.CORE_VERSION]
|
||||
*/
|
||||
|
@ -69,13 +69,13 @@ public class MiraiConsoleGradlePlugin : Plugin<Project> {
|
||||
|
||||
val isJvm = target.platformType == KotlinPlatformType.jvm || target.platformType == KotlinPlatformType.androidJvm
|
||||
|
||||
if (!miraiExtension.noCore) compileOnly("net.mamoe:mirai-core:${miraiExtension.coreVersion}")
|
||||
if (!miraiExtension.noCoreApi) compileOnly("net.mamoe:mirai-core-api:${miraiExtension.coreVersion}")
|
||||
if (!miraiExtension.noConsole && isJvm) compileOnly("net.mamoe:mirai-console:${miraiExtension.consoleVersion}")
|
||||
|
||||
if (sourceSet.name.endsWith("test", ignoreCase = true)) {
|
||||
if (!miraiExtension.noCore) api("net.mamoe:mirai-core:${miraiExtension.coreVersion}")
|
||||
if (!miraiExtension.noCoreApi) api("net.mamoe:mirai-core-api:${miraiExtension.coreVersion}")
|
||||
if (!miraiExtension.noConsole && isJvm) api("net.mamoe:mirai-console:${miraiExtension.consoleVersion}")
|
||||
if (!miraiExtension.noTestCoreQQAndroid) api("net.mamoe:mirai-core-qqandroid:${miraiExtension.coreVersion}")
|
||||
if (!miraiExtension.noTestCore) api("net.mamoe:mirai-core:${miraiExtension.coreVersion}")
|
||||
if (isJvm) {
|
||||
when (miraiExtension.useTestConsoleFrontEnd) {
|
||||
MiraiConsoleFrontEndKind.TERMINAL -> api("net.mamoe:mirai-console-terminal:${miraiExtension.consoleVersion}")
|
||||
|
@ -10,6 +10,6 @@
|
||||
package net.mamoe.mirai.console.gradle
|
||||
|
||||
internal object VersionConstants {
|
||||
const val CONSOLE_VERSION = "2.0-M1-dev-1" // value is written here automatically during build
|
||||
const val CORE_VERSION = "2.0-M1-dev-3" // value is written here automatically during build
|
||||
const val CONSOLE_VERSION = "2.0-M1" // value is written here automatically during build
|
||||
const val CORE_VERSION = "2.0-M1" // value is written here automatically during build
|
||||
}
|
Loading…
Reference in New Issue
Block a user