diff --git a/Dockerfile b/Dockerfile index 8cbcf5b..7d6e70c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,4 @@ LABEL authors="Kane" WORKDIR /opt ADD target/Mirai-bot-0.0.1-SNAPSHOT.jar /opt/Mirai-bot.jar -ADD android_pad.json /opt/android_pad.json -ADD device.json /opt/device.json -ADD KFCFactory.json /opt/KFCFactory.json ENTRYPOINT java -jar /opt/Mirai-bot.jar diff --git a/KFCFactory.json b/KFCFactory.json deleted file mode 100644 index b23a6f5..0000000 --- a/KFCFactory.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "9.0.56": { - "base_url": "https://qsign.trpgbot.com", - "type": "fuqiuluo/unidbg-fetch-qsign", - "key": "114514" - }, - "9.0.95": { - "base_url": "https://qsign.trpgbot.com", - "type": "fuqiuluo/unidbg-fetch-qsign", - "key": "114514" - } -} diff --git a/android_pad.json b/android_pad.json deleted file mode 100644 index 13bfc10..0000000 --- a/android_pad.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "apk_id": "com.tencent.mobileqq", - "app_id": 537220362, - "sub_app_id": 537220362, - "app_key": "0S200MNJT807V3GE", - "sort_version_name": "9.0.56.16830", - "build_time": 1713424357, - "apk_sign": "a6b745bf24a2c277527716f6f36eb68d", - "sdk_version": "6.0.0.2560", - "sso_version": 21, - "misc_bitmap": 150470524, - "main_sig_map": 34869472, - "sub_sig_map": 66560, - "dump_time": 1713424357, - "qua": "V1_AND_SQ_9.0.56_6372_YYB_D", - "protocol_type": 6 -} diff --git a/device.json b/device.json deleted file mode 100644 index cfb7c9e..0000000 --- a/device.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "deviceInfoVersion": 3, - "data": { - "display": "MIRAI.056598.001", - "product": "mirai", - "device": "mirai", - "board": "mirai", - "brand": "mamoe", - "model": "mirai", - "bootloader": "unknown", - "fingerprint": "mamoe/mirai/mirai:10/MIRAI.200122.001/9082187:user/release-keys", - "bootId": "26692CCB-72A7-BF68-942E-0D435E0ACE47", - "procVersion": "Linux version 3.0.31-8RRLhiT0 (android-build@xxx.xxx.xxx.xxx.com)", - "baseBand": "", - "version": { - "incremental": "5891938", - "release": "10", - "codename": "REL" - }, - "simInfo": "T-Mobile", - "osType": "android", - "macAddress": "02:00:00:00:00:00", - "wifiBSSID": "02:00:00:00:00:00", - "wifiSSID": "", - "imsiMd5": "53763c791f940fddcb65d09ed3700272", - "imei": "867739141234828", - "apn": "wifi", - "androidId": "aa28d5bd4d1d1822" - } -} diff --git a/pom.xml b/pom.xml index ddc803e..f150996 100644 --- a/pom.xml +++ b/pom.xml @@ -53,6 +53,17 @@ HuaweiCloud https://mirrors.huaweicloud.com/repository/maven + + + MavenOfficial + MavenOfficial + https://repo.maven.apache.org/maven2 + + + MavenOfficial + MavenOfficial + https://repo.maven.apache.org/maven2 + @@ -109,9 +120,16 @@ + + + top.mrxiaom.mirai + overflow-core + 1.0.1 + + net.mamoe - mirai-core-jvm + mirai-core-api-jvm 2.16.0 diff --git a/src/main/kotlin/info/alinadace/miraibot/bean/BotConfiguration.kt b/src/main/kotlin/info/alinadace/miraibot/bean/BotConfiguration.kt index 261bfeb..9b13f95 100644 --- a/src/main/kotlin/info/alinadace/miraibot/bean/BotConfiguration.kt +++ b/src/main/kotlin/info/alinadace/miraibot/bean/BotConfiguration.kt @@ -2,15 +2,15 @@ package info.alinadace.miraibot.bean import info.alinadace.miraibot.annotation.BotFunction import info.alinadace.miraibot.configuration.BotConfig -import info.alinadace.miraibot.enums.LoginType import info.alinadace.miraibot.service.Service +import kotlinx.coroutines.async +import kotlinx.coroutines.runBlocking import net.mamoe.mirai.Bot -import net.mamoe.mirai.BotFactory -import net.mamoe.mirai.auth.BotAuthorization import net.mamoe.mirai.event.Event import net.mamoe.mirai.utils.BotConfiguration import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration +import top.mrxiaom.overflow.BotBuilder import kotlin.reflect.KClass /** @@ -23,15 +23,13 @@ class BotConfiguration { @Bean fun bot(config: BotConfig): Bot { - return when (config.type) { - LoginType.PASSWORD -> BotFactory.newBot(config.id, config.password) { - extracted() - } - - LoginType.QRCODE -> BotFactory.newBot(config.id, BotAuthorization.byQRCode()) { - extracted() + val connect = runBlocking { + val bot = async { + BotBuilder.positive(config.ws).token(config.token).connect() ?: throw Exception("Bot connect failed") } + bot.await() } + return connect } @Bean("functionMap") diff --git a/src/main/kotlin/info/alinadace/miraibot/configuration/BotConfig.kt b/src/main/kotlin/info/alinadace/miraibot/configuration/BotConfig.kt index 5162093..5ce7e36 100644 --- a/src/main/kotlin/info/alinadace/miraibot/configuration/BotConfig.kt +++ b/src/main/kotlin/info/alinadace/miraibot/configuration/BotConfig.kt @@ -15,18 +15,31 @@ class BotConfig { /** * 机器人QQ号 */ + @Deprecated(message = "内部认证已失效") final var id: Long = 0L /** * 机器人密码 */ + @Deprecated(message = "内部认证已失效") final var password: String = "" /** * 机器人登录方式 */ + @Deprecated(message = "内部认证已失效") final var type: LoginType = LoginType.PASSWORD + /** + * 机器人ws地址 + */ + final var ws: String = "" + + /** + * 机器人token + */ + final var token: String = "" + /** * 管理员QQ */ @@ -34,10 +47,13 @@ class BotConfig { constructor() - constructor(id: Long, password: String, type: LoginType, admin: Long) { + constructor(id: Long, password: String, type: LoginType, ws: String, token: String, admin: Long) { this.id = id this.password = password this.type = type + this.ws = ws + this.token = token this.admin = admin } + }