mirror of https://github.com/Nofated095/Q2TG.git
feat: oicq 掉线提醒
This commit is contained in:
parent
e870e6bff3
commit
991b1280a7
|
@ -0,0 +1,11 @@
|
|||
import Instance from '../models/Instance';
|
||||
import OicqClient from '../client/OicqClient';
|
||||
|
||||
export default class OicqErrorNotifyController {
|
||||
public constructor(private readonly instance: Instance,
|
||||
private readonly oicq: OicqClient) {
|
||||
oicq.on('system.offline', async ({ message }) => {
|
||||
await instance.ownerChat.sendMessage(`<i>QQ 机器人掉线</i>\n${message}`);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@ import { Api } from 'telegram';
|
|||
import commands from '../constants/commands';
|
||||
import TelegramChat from '../client/TelegramChat';
|
||||
import RequestController from '../controllers/RequestController';
|
||||
import OicqErrorNotifyController from '../controllers/OicqErrorNotifyController';
|
||||
|
||||
export default class Instance {
|
||||
private _owner = 0;
|
||||
|
@ -37,6 +38,7 @@ export default class Instance {
|
|||
public forwardPairs: ForwardPairs;
|
||||
private setupController: SetupController;
|
||||
private instanceManageController: InstanceManageController;
|
||||
private oicqErrorNotifyController: OicqErrorNotifyController;
|
||||
private requestController: RequestController;
|
||||
private configController: ConfigController;
|
||||
private deleteMessageController: DeleteMessageController;
|
||||
|
@ -108,6 +110,7 @@ export default class Instance {
|
|||
if (this.id === 0) {
|
||||
this.instanceManageController = new InstanceManageController(this, this.tgBot);
|
||||
}
|
||||
this.oicqErrorNotifyController = new OicqErrorNotifyController(this, this.oicq);
|
||||
this.requestController = new RequestController(this, this.tgBot, this.oicq);
|
||||
this.configController = new ConfigController(this, this.tgBot, this.tgUser, this.oicq);
|
||||
this.deleteMessageController = new DeleteMessageController(this, this.tgBot, this.tgUser, this.oicq);
|
||||
|
|
Loading…
Reference in New Issue