some changes
This commit is contained in:
parent
9c6a31e765
commit
cf43d997d5
@ -210,6 +210,7 @@ class SqueebotCommandsAPIPlugin extends Plugin {
|
|||||||
// Done
|
// Done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventListener('message')
|
||||||
public digest(msg: IMessage): void {
|
public digest(msg: IMessage): void {
|
||||||
if (msg.type !== EMessageType.message) {
|
if (msg.type !== EMessageType.message) {
|
||||||
return;
|
return;
|
||||||
@ -333,10 +334,11 @@ class SqueebotCommandsAPIPlugin extends Plugin {
|
|||||||
withAliases.push(spec);
|
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
|
// Iteration 3: Match permissions for user
|
||||||
// TODO: permission matching
|
matching = this.permissionMatcher(msg, matching);
|
||||||
|
|
||||||
const text = msg.data.text ? msg.data.text : msg.data;
|
const text = msg.data.text ? msg.data.text : msg.data;
|
||||||
const argv = text.toLowerCase().split(' ');
|
const argv = text.toLowerCase().split(' ');
|
||||||
@ -405,17 +407,14 @@ class SqueebotCommandsAPIPlugin extends Plugin {
|
|||||||
this.permissions = null;
|
this.permissions = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventListener('message')
|
|
||||||
messageHandler(msg: IMessage): void {
|
|
||||||
this.digest(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventListener('pluginUnload')
|
@EventListener('pluginUnload')
|
||||||
unloadEventHandler(plugin: string | Plugin): void {
|
unloadEventHandler(plugin: string | Plugin): void {
|
||||||
if (plugin === this.name || plugin === this) {
|
if (plugin === this.name || plugin === this) {
|
||||||
logger.debug('[%s] shutting down..', this.name);
|
logger.debug('[%s] shutting down..', this.name);
|
||||||
this.config.save().then(() =>
|
this.config.save().then(() =>
|
||||||
this.emit('pluginUnloaded', this));
|
this.emit('pluginUnloaded', this));
|
||||||
|
} else {
|
||||||
|
this.unregisterPlugin((typeof plugin === 'string' ? plugin : plugin.manifest.name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user