3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Merge branch 'DarkView-automoMessageLink'

This commit is contained in:
Dragory 2020-05-22 21:15:51 +03:00
commit db7400152e
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -1363,12 +1363,19 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema, ICustomOverride
const channel = this.guild.channels.get(rule.actions.alert.channel);
if (channel && channel instanceof TextChannel) {
const text = rule.actions.alert.text;
let messageLink = "";
if (!actionsTaken.includes("clean")) {
messageLink = this.getActionedMessageLink(matchResult);
} else {
messageLink = "*Message cleaned - no link*";
}
const rendered = await renderTemplate(rule.actions.alert.text, {
rule: rule.name,
user: safeUser,
users: safeUsers,
text,
matchSummary,
messageLink,
logMessage,
});
channel.createMessage(rendered);
@ -1605,4 +1612,12 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema, ICustomOverride
msg.channel.createMessage("Anti-raid is off!");
}
}
public getActionedMessageLink(matchResult: AnyTriggerMatchResult): string {
if (matchResult.type === "message" || matchResult.type === "embed") {
return `https://discord.com/channels/${this.guild.id}/${matchResult.messageInfo.channelId}/${matchResult.messageInfo.messageId}`;
} else {
return ``;
}
}
}