mirror of
https://github.com/janderedev/automod.git
synced 2024-12-22 10:45:27 +00:00
allow custom rules on message update
This commit is contained in:
parent
0ebfb7380f
commit
1547512a1c
|
@ -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}`);
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue