add reject

This commit is contained in:
Evert Prants 2020-12-13 12:17:40 +02:00
parent 9358be43fc
commit 366c49a346
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 11 additions and 5 deletions

View File

@ -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": []
}

View File

@ -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[] {

View File

@ -3,7 +3,7 @@
"plugins": [
{
"name": "irc",
"version": "1.0.0"
"version": "1.1.0"
},
{
"name": "ircprototest",