Release 3.4.0 #19
@ -27,7 +27,9 @@
|
|||||||
"@typescript-eslint/no-unused-vars": "off",
|
"@typescript-eslint/no-unused-vars": "off",
|
||||||
"@typescript-eslint/no-non-null-assertion": "off",
|
"@typescript-eslint/no-non-null-assertion": "off",
|
||||||
"@typescript-eslint/no-misused-promises": ["error", {
|
"@typescript-eslint/no-misused-promises": ["error", {
|
||||||
// "checksVoidReturn": false
|
"checksVoidReturn": {
|
||||||
|
"arguments": false
|
||||||
|
}
|
||||||
}],
|
}],
|
||||||
"accessor-pairs": "warn",
|
"accessor-pairs": "warn",
|
||||||
"array-callback-return": "warn",
|
"array-callback-return": "warn",
|
||||||
|
@ -170,8 +170,7 @@ class ModerationManager implements Initialisable, CallbackClient
|
|||||||
constructor (client: DiscordClient)
|
constructor (client: DiscordClient)
|
||||||
{
|
{
|
||||||
this.#client = client;
|
this.#client = client;
|
||||||
// this.#callbacks = new Collection();
|
this.#logger = client.createLogger(this);
|
||||||
this.#logger = client.createLogger(this); // new Logger({ name: 'ModMngr' });
|
|
||||||
this.#infractionClasses = Constant.Infractions;
|
this.#infractionClasses = Constant.Infractions;
|
||||||
this.#ready = false;
|
this.#ready = false;
|
||||||
}
|
}
|
||||||
@ -418,11 +417,6 @@ class ModerationManager implements Initialisable, CallbackClient
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {class} Infraction
|
|
||||||
* @param {User | GuildMember} target
|
|
||||||
* @param {object} info
|
|
||||||
* @return {Infraction}
|
|
||||||
* @memberof ModerationManager
|
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line max-lines-per-function
|
// eslint-disable-next-line max-lines-per-function
|
||||||
async _handleTarget (
|
async _handleTarget (
|
||||||
@ -431,7 +425,6 @@ class ModerationManager implements Initialisable, CallbackClient
|
|||||||
info: HandleTargetData
|
info: HandleTargetData
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// wrapper: guildWrapper
|
|
||||||
const { reason, force, guild } = info;
|
const { reason, force, guild } = info;
|
||||||
const { automod, modpoints } = await guild.settings();
|
const { automod, modpoints } = await guild.settings();
|
||||||
const { Type: type } = Infraction;
|
const { Type: type } = Infraction;
|
||||||
@ -609,13 +602,12 @@ class ModerationManager implements Initialisable, CallbackClient
|
|||||||
|
|
||||||
async handleCallback (_id: string, infraction: InfractionJSON)
|
async handleCallback (_id: string, infraction: InfractionJSON)
|
||||||
{
|
{
|
||||||
// const infraction = await this.#client.mongodb.infractions.findOne({ id });
|
|
||||||
if (!infraction)
|
if (!infraction)
|
||||||
return;
|
return;
|
||||||
this.#logger.debug(`Infraction callback: ${infraction.id} (${infraction.type})`);
|
this.#logger.debug(`Infraction callback: ${infraction.id} (${infraction.type})`);
|
||||||
const undoClass = Constant.Infractions[Constants.InfractionOpposites[infraction.type]];
|
const undoClass = Constant.Infractions[Constants.InfractionOpposites[infraction.type]];
|
||||||
if (!undoClass)
|
if (!undoClass)
|
||||||
return;
|
return this.#logger.error(`Missing undo class for ${infraction.type}`);
|
||||||
|
|
||||||
const guild = await this.#client.getGuildWrapper(infraction.guild!);
|
const guild = await this.#client.getGuildWrapper(infraction.guild!);
|
||||||
if (!guild)
|
if (!guild)
|
||||||
@ -646,7 +638,7 @@ class ModerationManager implements Initialisable, CallbackClient
|
|||||||
throw new Error('Missing executor');
|
throw new Error('Missing executor');
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await new undoClass(this.#client, this.#logger, {
|
const result = await new undoClass(this.#client, this.#logger, {
|
||||||
type: undoClass.Type,
|
type: undoClass.Type,
|
||||||
reason: `AUTO-${Constants.InfractionOpposites[infraction.type]} from Case ${infraction.case}`,
|
reason: `AUTO-${Constants.InfractionOpposites[infraction.type]} from Case ${infraction.case}`,
|
||||||
channel,
|
channel,
|
||||||
@ -657,6 +649,8 @@ class ModerationManager implements Initialisable, CallbackClient
|
|||||||
target,
|
target,
|
||||||
executor
|
executor
|
||||||
}).execute();
|
}).execute();
|
||||||
|
if (result.error)
|
||||||
|
this.#logger.error(result);
|
||||||
}
|
}
|
||||||
catch (err)
|
catch (err)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user