some changes

This commit is contained in:
Evert Prants 2020-11-29 21:07:06 +02:00
parent 9c6a31e765
commit cf43d997d5
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
1 changed files with 7 additions and 8 deletions

View File

@ -210,6 +210,7 @@ class SqueebotCommandsAPIPlugin extends Plugin {
// Done
}
@EventListener('message')
public digest(msg: IMessage): void {
if (msg.type !== EMessageType.message) {
return;
@ -333,10 +334,11 @@ class SqueebotCommandsAPIPlugin extends Plugin {
withAliases.push(spec);
}
const matching = this.roomMatcher(msg, withAliases);
// Iteration 2: Match rooms for message
let matching = this.roomMatcher(msg, withAliases);
// Iteration 2: Match permissions for user
// TODO: permission matching
// Iteration 3: Match permissions for user
matching = this.permissionMatcher(msg, matching);
const text = msg.data.text ? msg.data.text : msg.data;
const argv = text.toLowerCase().split(' ');
@ -405,17 +407,14 @@ class SqueebotCommandsAPIPlugin extends Plugin {
this.permissions = null;
}
@EventListener('message')
messageHandler(msg: IMessage): void {
this.digest(msg);
}
@EventListener('pluginUnload')
unloadEventHandler(plugin: string | Plugin): void {
if (plugin === this.name || plugin === this) {
logger.debug('[%s] shutting down..', this.name);
this.config.save().then(() =>
this.emit('pluginUnloaded', this));
} else {
this.unregisterPlugin((typeof plugin === 'string' ? plugin : plugin.manifest.name));
}
}
}