Display case ID with success message
This commit is contained in:
parent
e9c17cd830
commit
faa10fef8a
@ -213,14 +213,14 @@ class ModerationManager implements Initialisable
|
||||
const successes: {
|
||||
[key in InfractionType]?: {
|
||||
targets: string[],
|
||||
infraction: InfractionClass,
|
||||
infractions: InfractionClass[],
|
||||
escalation: boolean
|
||||
}
|
||||
} = {};
|
||||
const fails: {
|
||||
[key in InfractionType]?: {
|
||||
targets: string[],
|
||||
infraction: InfractionClass,
|
||||
infractions: InfractionClass[],
|
||||
reason: string,
|
||||
formatted: boolean
|
||||
}
|
||||
@ -233,25 +233,27 @@ class ModerationManager implements Initialisable
|
||||
if (successes[type])
|
||||
{
|
||||
successes[type]!.targets.push(Util.isUserStruct(target) ? target.tag : target!.name);
|
||||
successes[type]!.infractions.push(response.infraction);
|
||||
}
|
||||
else
|
||||
{
|
||||
successes[type] = {
|
||||
targets: [ Util.isUserStruct(target) ? target.tag : target!.name ],
|
||||
infraction: response.infraction,
|
||||
infractions: [ response.infraction ],
|
||||
escalation: response.escalation
|
||||
};
|
||||
}
|
||||
}
|
||||
else if (fails[type] && response.error)
|
||||
{
|
||||
fails[type]?.targets.push(Util.isUserStruct(target) ? target.tag : target!.name);
|
||||
fails[type]!.targets.push(Util.isUserStruct(target) ? target.tag : target!.name);
|
||||
fails[type]!.infractions.push(response.infraction);
|
||||
}
|
||||
else if (response.error)
|
||||
{
|
||||
fails[type] = {
|
||||
targets: [ Util.isUserStruct(target) ? target.tag : target!.name ],
|
||||
infraction: response.infraction,
|
||||
infractions: [ response.infraction ],
|
||||
reason: response.reason,
|
||||
formatted: response.formatted
|
||||
};
|
||||
@ -267,8 +269,9 @@ class ModerationManager implements Initialisable
|
||||
{
|
||||
for (const [ , data ] of Object.entries(successes))
|
||||
{
|
||||
const { dictionary, targetType } = data.infraction;
|
||||
const reason = Util.escapeMarkdown(data.infraction.reason);
|
||||
const [ infraction ] = data.infractions;
|
||||
const { dictionary, targetType } = infraction;
|
||||
const reason = Util.escapeMarkdown(infraction.reason);
|
||||
// data.escalation ?
|
||||
// invoker.format('INFRACTION_ESCALATIONREASON') :
|
||||
// Util.escapeMarkdown(data.infraction.reason);
|
||||
@ -278,7 +281,8 @@ class ModerationManager implements Initialisable
|
||||
target: data.targets.map((t) => `**${Util.escapeMarkdown(t)}**`).join(' '),
|
||||
text: ` ${reason.length > 120
|
||||
? `for: \`${reason.substring(0, 117)}...\``
|
||||
: `for: \`${reason}\``}`
|
||||
: `for: \`${reason}\``}`,
|
||||
case: data.infractions.map(inf => inf.case).join('`, `')
|
||||
// !data.escalation ?
|
||||
// ` ${reason.length > 120 ?
|
||||
// `for: \`${reason.substring(0, 117)}...\`` :
|
||||
@ -289,11 +293,12 @@ class ModerationManager implements Initialisable
|
||||
}
|
||||
for (const [ , data ] of Object.entries(fails))
|
||||
{
|
||||
const { dictionary, targetType } = data.infraction;
|
||||
const [ infraction ] = data.infractions;
|
||||
const { dictionary, targetType } = infraction;
|
||||
const str = `${Emojis.failure} ${invoker.format('INFRACTION_FAIL', {
|
||||
infraction: dictionary.present,
|
||||
targetType: `${targetType.toLowerCase()}${data.targets.length === 1 ? '' : 's'}`,
|
||||
target: data.targets.map((t) => `**${Util.escapeMarkdown(t)}**`).join(' '),
|
||||
target: data.targets.map((t) => `**${Util.escapeMarkdown(t)}**`).join(', '),
|
||||
reason: data.formatted ? data.reason : invoker.format(data.reason)
|
||||
})}`;
|
||||
if (!('escalation' in data) && !success)
|
||||
|
@ -24,6 +24,8 @@ auto-moderation escalated this infraction.
|
||||
|
||||
[INFRACTION_SUCCESS]
|
||||
Successfully {infraction} {targetType} {target}{text}
|
||||
# ** ** **Case:** `{case}`
|
||||
{emoji_book} **Case:** `{case}`
|
||||
|
||||
[INFRACTION_FAIL]
|
||||
Failed to {infraction} {targetType} {target} because {reason}.
|
||||
|
Loading…
Reference in New Issue
Block a user