This commit is contained in:
idranme 2024-10-19 15:57:58 +08:00
parent 364dfe8b93
commit 5b90a25f8f
5 changed files with 18 additions and 8 deletions

View File

@ -44,6 +44,7 @@ export class ConfigUtil {
token: ''
}
const defaultConfig: Config = {
enableLLOB: true,
satori: satoriDefault,
ob11: ob11Default,
heartInterval: 60000,

View File

@ -28,6 +28,7 @@ export interface SatoriConfig {
}
export interface Config {
enableLLOB: boolean
satori: SatoriConfig
ob11: OB11Config
token?: string
@ -49,8 +50,6 @@ export interface Config {
/** @deprecated */
wsPort?: string
/** @deprecated */
enableLLOB?: boolean
/** @deprecated */
reportSelfMessage?: boolean
}

View File

@ -182,6 +182,15 @@ function onLoad() {
log('process pid', process.pid)
const config = getConfigUtil().getConfig()
if (config.enableLLOB && (config.satori.enable || config.ob11.enable)) {
startHook()
} else {
llonebotError.otherError = 'LLOneBot 未启动'
log('LLOneBot 开关设置为关闭,不启动 LLOneBot')
return
}
ctx.plugin(Log, {
enable: config.log!,
filename: logFileName
@ -224,7 +233,6 @@ function onBrowserWindowCreated(window: BrowserWindow) {
try {
onLoad()
startHook()
} catch (e) {
console.log(e)
}

View File

@ -47,11 +47,6 @@ class Core extends Service {
}
public start() {
if (!this.config.ob11.enable && !this.config.satori.enable) {
llonebotError.otherError = 'LLOneBot 未启动'
this.ctx.logger.info('LLOneBot 开关设置为关闭,不启动 LLOneBot')
return
}
this.startTime = Date.now()
this.registerListener()
this.ctx.logger.info(`LLOneBot/${version}`)

View File

@ -43,6 +43,13 @@ async function onSettingWindowCreated(view: Element) {
SettingButton('请稍候', 'llonebot-update-button', 'secondary'),
),
]),
SettingList([
SettingItem(
'是否启用 LLOneBot重启 QQ 后生效',
null,
SettingSwitch('enableLLOB', config.enableLLOB, { 'control-display-id': 'config-enableLLOB' }),
)
]),
SettingList([
SettingItem(
'是否启用 Satori 协议',