mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: webui reload
This commit is contained in:
@@ -195,6 +195,16 @@ export class NapCatOneBot11Adapter {
|
|||||||
nowConfig: NetworkConfigAdapter[],
|
nowConfig: NetworkConfigAdapter[],
|
||||||
adapterClass: new (...args: any[]) => IOB11NetworkAdapter
|
adapterClass: new (...args: any[]) => IOB11NetworkAdapter
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
// 比较旧的在新的找不到的回收
|
||||||
|
for (const adapterConfig of prevConfig) {
|
||||||
|
const existingAdapter = nowConfig.find((e) => e.name === adapterConfig.name);
|
||||||
|
if (!existingAdapter) {
|
||||||
|
const existingAdapter = this.networkManager.findSomeAdapter(adapterConfig.name);
|
||||||
|
if (existingAdapter) {
|
||||||
|
await this.networkManager.closeSomeAdaterWhenOpen([existingAdapter]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 通知新配置重载 删除关闭的 加入新开的
|
// 通知新配置重载 删除关闭的 加入新开的
|
||||||
for (const adapterConfig of nowConfig) {
|
for (const adapterConfig of nowConfig) {
|
||||||
const existingAdapter = this.networkManager.findSomeAdapter(adapterConfig.name);
|
const existingAdapter = this.networkManager.findSomeAdapter(adapterConfig.name);
|
||||||
@@ -203,21 +213,11 @@ export class NapCatOneBot11Adapter {
|
|||||||
if (networkChange === OB11NetworkReloadType.NetWorkClose) {
|
if (networkChange === OB11NetworkReloadType.NetWorkClose) {
|
||||||
await this.networkManager.closeSomeAdaterWhenOpen([existingAdapter]);
|
await this.networkManager.closeSomeAdaterWhenOpen([existingAdapter]);
|
||||||
}
|
}
|
||||||
} else {
|
} else if(adapterConfig.enable) {
|
||||||
const newAdapter = new adapterClass(adapterConfig.name, adapterConfig, this.core, this.actions);
|
const newAdapter = new adapterClass(adapterConfig.name, adapterConfig, this.core, this.actions);
|
||||||
await this.networkManager.registerAdapterAndOpen(newAdapter);
|
await this.networkManager.registerAdapterAndOpen(newAdapter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 比较旧的找不到的回收
|
|
||||||
for (const adapterConfig of prevConfig) {
|
|
||||||
const existingAdapter = nowConfig.find((e) => e.name === adapterConfig.name);
|
|
||||||
if (!existingAdapter) {
|
|
||||||
const existingAdapter = this.networkManager.findSomeAdapter(adapterConfig.name);
|
|
||||||
if (existingAdapter) {
|
|
||||||
await this.networkManager.closeSomeAdaterWhenOpen([existingAdapter]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private initMsgListener() {
|
private initMsgListener() {
|
||||||
|
Reference in New Issue
Block a user