From 4785d2a0554767eccda498341eafe6f47c766faa Mon Sep 17 00:00:00 2001 From: MrXiaoM Date: Mon, 4 Dec 2023 18:51:13 +0800 Subject: [PATCH] support connect token --- .../main/kotlin/top/mrxiaom/overflow/internal/Config.kt | 2 ++ .../main/kotlin/top/mrxiaom/overflow/internal/Overflow.kt | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/overflow-core/src/main/kotlin/top/mrxiaom/overflow/internal/Config.kt b/overflow-core/src/main/kotlin/top/mrxiaom/overflow/internal/Config.kt index 749909cd..7505a0da 100644 --- a/overflow-core/src/main/kotlin/top/mrxiaom/overflow/internal/Config.kt +++ b/overflow-core/src/main/kotlin/top/mrxiaom/overflow/internal/Config.kt @@ -9,4 +9,6 @@ data class Config( var wsHost: String = "ws://127.0.0.1:5800", @SerialName("reversed_ws_port") var reversedWSPort: Int = -1, + @SerialName("token") + var token: String = "" ) \ No newline at end of file diff --git a/overflow-core/src/main/kotlin/top/mrxiaom/overflow/internal/Overflow.kt b/overflow-core/src/main/kotlin/top/mrxiaom/overflow/internal/Overflow.kt index 9626d465..eae7512a 100644 --- a/overflow-core/src/main/kotlin/top/mrxiaom/overflow/internal/Overflow.kt +++ b/overflow-core/src/main/kotlin/top/mrxiaom/overflow/internal/Overflow.kt @@ -145,7 +145,12 @@ class Overflow : IMirai, CoroutineScope, LowLevelApiAccessor, OverflowAPI { } val service = ConnectFactory.create( - BotConfig(config.wsHost, config.reversedWSPort), logger + BotConfig( + url = config.wsHost, + reversedPort = config.reversedWSPort, + token = config.token, + isAccessToken = config.token.isNotBlank() + ), logger ) val dispatchers: EventBus val botImpl: cn.evolvefield.onebot.client.core.Bot