mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-23 22:00:10 +08:00
Update to 1.0-RC2
This commit is contained in:
parent
cb6dec87e2
commit
a624f56285
@ -11,10 +11,9 @@ import org.gradle.kotlin.dsl.DependencyHandlerScope
|
||||
|
||||
object Versions {
|
||||
object Mirai {
|
||||
const val core = "1.0-RC"
|
||||
const val core = "1.0-RC2-1"
|
||||
const val console = "0.5.1"
|
||||
const val consoleGraphical = "0.0.7"
|
||||
const val consoleWrapper = "1.1.0"
|
||||
}
|
||||
|
||||
object Kotlin {
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
package net.mamoe.mirai.console
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.io.charsets.Charset
|
||||
import net.mamoe.mirai.Bot
|
||||
import net.mamoe.mirai.console.command.CommandManager
|
||||
@ -19,13 +20,15 @@ import net.mamoe.mirai.utils.SimpleLogger.LogPriority
|
||||
import net.mamoe.mirai.utils.WeakRef
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.PrintStream
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
|
||||
|
||||
object MiraiConsole {
|
||||
object MiraiConsole : CoroutineScope by CoroutineScope(EmptyCoroutineContext) {
|
||||
/**
|
||||
* 发布的版本名
|
||||
*/
|
||||
const val build = "Pkmon"
|
||||
|
||||
lateinit var version: String
|
||||
internal set
|
||||
|
||||
@ -102,7 +105,7 @@ object MiraiConsole {
|
||||
frontEnd: MiraiConsoleUI,
|
||||
coreVersion: String = "0.0.0",
|
||||
consoleVersion: String = "0.0.0",
|
||||
path:String = System.getProperty("user.dir")
|
||||
path: String = System.getProperty("user.dir")
|
||||
) {
|
||||
if (started) {
|
||||
return
|
||||
|
@ -29,8 +29,7 @@ import java.util.*
|
||||
/**
|
||||
* Some defaults commands are recommend to be replaced by plugin provided commands
|
||||
*/
|
||||
|
||||
object DefaultCommands {
|
||||
internal object DefaultCommands {
|
||||
private val commandPrefix = "mirai.command.prefix".property() ?: "/"
|
||||
private suspend fun CommandSender.login(account: Long, password: String) {
|
||||
MiraiConsole.logger("[Bot Login]", 0, "login...")
|
||||
@ -57,8 +56,10 @@ object DefaultCommands {
|
||||
}
|
||||
}
|
||||
bot.login()
|
||||
bot.subscribeMessages {
|
||||
MiraiConsole.subscribeMessages {
|
||||
startsWith(commandPrefix) { message ->
|
||||
if (this.bot != bot) return@startsWith
|
||||
|
||||
if (bot.checkManager(this.sender.id)) {
|
||||
val sender = if (this is GroupMessageEvent) {
|
||||
GroupContactCommandSender(this.sender, this.subject)
|
||||
|
@ -21,8 +21,6 @@ import net.mamoe.mirai.utils.LockFreeLinkedList
|
||||
import net.mamoe.mirai.utils.SimpleLogger
|
||||
import java.io.File
|
||||
import java.io.InputStream
|
||||
import java.lang.reflect.Constructor
|
||||
import java.lang.reflect.Method
|
||||
import java.net.JarURLConnection
|
||||
import java.net.URL
|
||||
import java.util.jar.JarFile
|
||||
@ -385,21 +383,4 @@ object PluginManager {
|
||||
jar.entries().asSequence().filter { it.name == toFind }.firstOrNull() ?: return null
|
||||
return URL("jar:file:" + jarFile.absoluteFile + "!/" + toFindFile.name).openConnection().inputStream
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private val trySetAccessibleMethod: Method? = runCatching {
|
||||
Class.forName("java.lang.reflect.AccessibleObject").getMethod("trySetAccessible")
|
||||
}.getOrNull()
|
||||
|
||||
|
||||
private fun Constructor<out PluginBase>.againstPermission() {
|
||||
kotlin.runCatching {
|
||||
trySetAccessibleMethod?.let { it.invoke(this) }
|
||||
?: kotlin.runCatching {
|
||||
@Suppress("DEPRECATED")
|
||||
this.isAccessible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user