Merge branch 'DarkView-automoMessageLink'
This commit is contained in:
commit
db7400152e
1 changed files with 15 additions and 0 deletions
|
@ -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 ``;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue