mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat: init network
This commit is contained in:
parent
5d865270d7
commit
1498338a6e
@ -4,14 +4,18 @@ import { LaanaFileUtils } from '@/laana-v0.1.3/utils/file';
|
|||||||
import { LaanaMessageUtils } from '@/laana-v0.1.3/utils/message';
|
import { LaanaMessageUtils } from '@/laana-v0.1.3/utils/message';
|
||||||
import { LaanaActionHandler } from '@/laana-v0.1.3/action';
|
import { LaanaActionHandler } from '@/laana-v0.1.3/action';
|
||||||
import { LaanaMessageActionHandler } from '@/laana-v0.1.3/action/message';
|
import { LaanaMessageActionHandler } from '@/laana-v0.1.3/action/message';
|
||||||
|
import { LaanaConfigLoader } from '@/laana-v0.1.3/config';
|
||||||
|
import { LaanaNetworkManager } from '@/laana-v0.1.3/network';
|
||||||
|
import { LaanaWsServerAdapter } from '@/laana-v0.1.3/network/ws-server';
|
||||||
|
|
||||||
export class NapCatLaanaAdapter {
|
export class NapCatLaanaAdapter {
|
||||||
utils = {
|
utils = {
|
||||||
msg: new LaanaMessageUtils(this.core, this),
|
msg: new LaanaMessageUtils(this.core, this),
|
||||||
file: new LaanaFileUtils(this.core, this),
|
file: new LaanaFileUtils(this.core, this),
|
||||||
};
|
};
|
||||||
|
|
||||||
actions: LaanaActionHandler;
|
actions: LaanaActionHandler;
|
||||||
|
configLoader: LaanaConfigLoader;
|
||||||
|
networkManager: LaanaNetworkManager;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public core: NapCatCore,
|
public core: NapCatCore,
|
||||||
@ -21,5 +25,21 @@ export class NapCatLaanaAdapter {
|
|||||||
this.actions = {
|
this.actions = {
|
||||||
...new LaanaMessageActionHandler(this.core, this).impl,
|
...new LaanaMessageActionHandler(this.core, this).impl,
|
||||||
};
|
};
|
||||||
|
this.configLoader = new LaanaConfigLoader(this.core, this.pathWrapper.configPath);
|
||||||
|
|
||||||
|
this.networkManager = new LaanaNetworkManager();
|
||||||
|
if (this.configLoader.configData.network.ws.enabled) {
|
||||||
|
this.networkManager.registerAdapterAndOpen(
|
||||||
|
new LaanaWsServerAdapter(
|
||||||
|
this.configLoader.configData.network.ws.ip,
|
||||||
|
this.configLoader.configData.network.ws.port,
|
||||||
|
this.configLoader.configData.network.ws.heartbeat.enabled,
|
||||||
|
this.configLoader.configData.network.ws.heartbeat.interval,
|
||||||
|
this.configLoader.configData.network.ws.token,
|
||||||
|
this.core,
|
||||||
|
this,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user