From 366c49a346d1665f37b63a5e1a73673a13c6129f Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Sun, 13 Dec 2020 12:17:40 +0200 Subject: [PATCH] add reject --- irc/plugin.json | 4 ++-- irc/plugin.ts | 10 ++++++++-- squeebot.repo.json | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/irc/plugin.json b/irc/plugin.json index 920bf69..d9ec2ef 100644 --- a/irc/plugin.json +++ b/irc/plugin.json @@ -3,7 +3,7 @@ "name": "irc", "description": "IRC Service for Squeebot 3", "tags": ["service", "irc"], - "version": "1.0.0", - "dependencies": [], + "version": "1.1.0", + "dependencies": ["control?"], "npmDependencies": [] } diff --git a/irc/plugin.ts b/irc/plugin.ts index 6a2c0cb..1487a40 100644 --- a/irc/plugin.ts +++ b/irc/plugin.ts @@ -49,6 +49,11 @@ class IRCMessage implements IMessage { this.source.resolve(this, ...args); } + public reject(error: Error): void { + this.resolved = true; + this.source.resolve(this, error.message); + } + public mention(user: IMessageTarget): string { return user.name; } @@ -247,13 +252,14 @@ class IRCServicePlugin extends Plugin { for (const ins of list) { const newProto = new IRCProtocol(this, ins); logger.log('[%s] Starting IRC service "%s".', this.name, ins.name); - this.service?.use(newProto, true); this.monitor(newProto); + this.service?.use(newProto, true); } } private monitor(proto: Protocol): void { - // TODO + proto.on('running', () => this.emit('protocolNew', proto)); + proto.on('stopped', () => this.emit('protocolExit', proto)); } private validateConfiguration(): any[] { diff --git a/squeebot.repo.json b/squeebot.repo.json index c7eacc2..ecc3032 100644 --- a/squeebot.repo.json +++ b/squeebot.repo.json @@ -3,7 +3,7 @@ "plugins": [ { "name": "irc", - "version": "1.0.0" + "version": "1.1.0" }, { "name": "ircprototest",