3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-10 12:25:02 +00:00

Add 'reply' Automod action

This commit is contained in:
Dragory 2020-04-08 17:15:13 +03:00
parent af360eaa73
commit 65112b39bb
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
2 changed files with 18 additions and 0 deletions

View file

@ -1210,6 +1210,21 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema, ICustomOverride
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") {
for (const action of matchResult.recentActions) {
action.actioned = true;