This commit is contained in:
Erik 2022-07-10 11:55:23 +03:00
parent defbe1b310
commit 649ed41e92
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
2 changed files with 14 additions and 12 deletions

View File

@ -124,6 +124,8 @@ class ModerationManager {
}); });
} }
console.log(responses);
const success = Boolean(responses.some((r) => !r.error)); const success = Boolean(responses.some((r) => !r.error));
const succeeded = responses.filter((r) => !r.error); const succeeded = responses.filter((r) => !r.error);
const failed = responses.filter((r) => r.error); const failed = responses.filter((r) => r.error);
@ -138,17 +140,15 @@ class ModerationManager {
const fails = {}; const fails = {};
for (const response of responses) { for (const response of responses) {
const { type, target } = response.infraction; const { type, target } = response.infraction;
if (!response.error) { if (!response.error && !silent) {
if (!silent) { if (successes[type]) {
if (successes[type]) { successes[type].targets.push(target.tag || target.name);
successes[type].targets.push(target.tag || target.name); } else {
} else { successes[type] = {
successes[type] = { targets: [target.tag || target.name],
targets: [target.tag || target.name], infraction: response.infraction,
infraction: response.infraction, escalation: response.escalation
escalation: response.escalation };
};
}
} }
} else { } else {
if (fails[type]) { if (fails[type]) {
@ -163,6 +163,7 @@ class ModerationManager {
} }
} }
console.log(successes);
const succeededTargets = succeeded.map((s) => s.infraction.target); const succeededTargets = succeeded.map((s) => s.infraction.target);
const actions = await this._handleArguments(invoker, succeededTargets, args); //eslint-disable-line no-unused-vars const actions = await this._handleArguments(invoker, succeededTargets, args); //eslint-disable-line no-unused-vars
@ -186,6 +187,7 @@ class ModerationManager {
data.escalation ? string += str : string = `${str}\n${string}`; //eslint-disable-line data.escalation ? string += str : string = `${str}\n${string}`; //eslint-disable-line
} }
} }
console.log(string);
for (const [, data] of Object.entries(fails)) { for (const [, data] of Object.entries(fails)) {
const { dictionary, targetType } = data.infraction; const { dictionary, targetType } = data.infraction;

View File

@ -26,7 +26,7 @@ class NoteCommand extends ModerationCommand {
return this.client.moderationManager.handleInfraction(Note, interaction, { return this.client.moderationManager.handleInfraction(Note, interaction, {
targets: users.value, targets: users.value,
args: { args: {
silent: silent || { value: true }, silent,
...args ...args
} }
}); });