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