automod: update match summaries for match_* triggers
This commit is contained in:
parent
06997b59b0
commit
b73c8668e3
6 changed files with 53 additions and 38 deletions
|
@ -4,6 +4,7 @@ import escapeStringRegexp from "escape-string-regexp";
|
|||
import { automodTrigger } from "../helpers";
|
||||
import { disableInlineCode, verboseChannelMention } from "../../../utils";
|
||||
import { MatchableTextType, matchMultipleTextTypesOnMessage } from "../functions/matchMultipleTextTypesOnMessage";
|
||||
import { getTextMatchPartialSummary } from "../functions/getTextMatchPartialSummary";
|
||||
|
||||
interface MatchResultType {
|
||||
word: string;
|
||||
|
@ -80,11 +81,7 @@ export const MatchWordsTrigger = automodTrigger<MatchResultType>()({
|
|||
},
|
||||
|
||||
renderMatchInformation({ pluginData, contexts, matchResult }) {
|
||||
const channel = pluginData.guild.channels.get(contexts[0].message.channel_id);
|
||||
const prettyChannel = verboseChannelMention(channel);
|
||||
|
||||
return `Matched word \`${disableInlineCode(matchResult.extra.word)}\` in message (\`${
|
||||
contexts[0].message.id
|
||||
}\`) in ${prettyChannel}:`;
|
||||
const partialSummary = getTextMatchPartialSummary(pluginData, matchResult.extra.type, contexts[0]);
|
||||
return `Matched word \`${disableInlineCode(matchResult.extra.word)}\` in ${partialSummary}`;
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue