mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
Add 'reply' Automod action
This commit is contained in:
parent
af360eaa73
commit
65112b39bb
2 changed files with 18 additions and 0 deletions
|
@ -1210,6 +1210,21 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema, ICustomOverride
|
||||||
actionsTaken.push("set antiraid level");
|
actionsTaken.push("set antiraid level");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rule.actions.reply && matchResult.type === "message") {
|
||||||
|
const channelId = matchResult.messageInfo.channelId;
|
||||||
|
const channel = this.guild.channels.get(channelId);
|
||||||
|
if (channel && channel instanceof TextChannel) {
|
||||||
|
const user = await this.resolveUser(matchResult.userId);
|
||||||
|
const formatted = await renderTemplate(rule.actions.reply, {
|
||||||
|
user: stripObjectToScalars(user),
|
||||||
|
});
|
||||||
|
if (formatted) {
|
||||||
|
await channel.createMessage(formatted);
|
||||||
|
actionsTaken.push("reply");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (matchResult.type === "textspam" || matchResult.type === "otherspam") {
|
if (matchResult.type === "textspam" || matchResult.type === "otherspam") {
|
||||||
for (const action of matchResult.recentActions) {
|
for (const action of matchResult.recentActions) {
|
||||||
action.actioned = true;
|
action.actioned = true;
|
||||||
|
|
|
@ -280,6 +280,8 @@ export const RemoveRolesAction = t.array(t.string);
|
||||||
|
|
||||||
export const SetAntiraidLevelAction = t.string;
|
export const SetAntiraidLevelAction = t.string;
|
||||||
|
|
||||||
|
export const ReplyAction = t.string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RULES
|
* RULES
|
||||||
*/
|
*/
|
||||||
|
@ -320,6 +322,7 @@ export const Rule = t.type({
|
||||||
add_roles: tNullable(AddRolesAction),
|
add_roles: tNullable(AddRolesAction),
|
||||||
remove_roles: tNullable(RemoveRolesAction),
|
remove_roles: tNullable(RemoveRolesAction),
|
||||||
set_antiraid_level: tNullable(SetAntiraidLevelAction),
|
set_antiraid_level: tNullable(SetAntiraidLevelAction),
|
||||||
|
reply: tNullable(ReplyAction),
|
||||||
}),
|
}),
|
||||||
cooldown: tNullable(t.string),
|
cooldown: tNullable(t.string),
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue