allow custom rules on message update

This commit is contained in:
janderedev 2022-01-16 16:34:30 +01:00
parent 0ebfb7380f
commit 1547512a1c
No known key found for this signature in database
GPG key ID: 5D5E18ACB990F57A
3 changed files with 5 additions and 1 deletions

View file

@ -31,6 +31,10 @@ let commands: Command[];
.map(async file => await import(path.join(dirname, '..', 'commands', file)) as Command)
)).map(c => (c as any).default)
client.on('message/update', async msg => {
checkCustomRules(msg, true);
});
client.on('message', async msg => {
logger.debug(`Message -> ${msg.content}`);

View file

@ -16,6 +16,7 @@ async function checkCustomRules(message: Message, isEdit: boolean = false) {
if (!rules) return;
for (let rule of rules) {
if (!rule?.trigger?.on) continue;
let onEdit = rule.trigger.on.includes('message/update');
let onNew = rule.trigger.on.includes('message/create');

View file

@ -2,7 +2,6 @@ class CustomRuleTrigger {
_id: string;
// Which events this rule should apply to
// todo: message/update is not implemented
on: ('message/create' | 'message/update')[];
// Regex or string to match the content of the message against. If omitted, rule applies to every message