Small fixes here and there
This commit is contained in:
parent
c8fb823b05
commit
eb0a63a4b9
@ -175,7 +175,6 @@ class LockdownInfraction extends Infraction
|
|||||||
|
|
||||||
async verify ()
|
async verify ()
|
||||||
{
|
{
|
||||||
|
|
||||||
const perms = (this.target as GuildChannel).permissionsFor(this.client.user!);
|
const perms = (this.target as GuildChannel).permissionsFor(this.client.user!);
|
||||||
const missing = perms?.missing([ 'ManageRoles', 'SendMessages', 'AddReactions', 'ViewChannel' ]);
|
const missing = perms?.missing([ 'ManageRoles', 'SendMessages', 'AddReactions', 'ViewChannel' ]);
|
||||||
if (!perms || missing?.length)
|
if (!perms || missing?.length)
|
||||||
|
@ -195,7 +195,6 @@ class MuteInfraction extends Infraction
|
|||||||
return this._fail('COMMAND_MUTE_MISSING_MANAGEROLE_PERM');
|
return this._fail('COMMAND_MUTE_MISSING_MANAGEROLE_PERM');
|
||||||
|
|
||||||
return super._verify();
|
return super._verify();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async resolve (_staff: UserWrapper, _reason: string, _notify: boolean): Promise<void | ResolveResult>
|
async resolve (_staff: UserWrapper, _reason: string, _notify: boolean): Promise<void | ResolveResult>
|
||||||
@ -212,7 +211,6 @@ class MuteInfraction extends Infraction
|
|||||||
error = false;
|
error = false;
|
||||||
|
|
||||||
const settings = await this.guild.settings();
|
const settings = await this.guild.settings();
|
||||||
|
|
||||||
const { removedRoles = [], muteType = settings.mute.type, muteRole = settings.mute.role } = this.data || {};
|
const { removedRoles = [], muteType = settings.mute.type, muteRole = settings.mute.role } = this.data || {};
|
||||||
// TODO: Change this to not rely on the member
|
// TODO: Change this to not rely on the member
|
||||||
const member = await this.guild.memberWrapper(this.targetId!).catch(() => null);
|
const member = await this.guild.memberWrapper(this.targetId!).catch(() => null);
|
||||||
|
@ -21,12 +21,10 @@ class WarnInfraction extends Infraction
|
|||||||
|
|
||||||
constructor (client: DiscordClient, logger: LoggerClient, opts: WarnData)
|
constructor (client: DiscordClient, logger: LoggerClient, opts: WarnData)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (opts.fetched)
|
if (opts.fetched)
|
||||||
super(client, logger, opts);
|
super(client, logger, opts);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
super(client, logger, {
|
super(client, logger, {
|
||||||
targetType: 'USER',
|
targetType: 'USER',
|
||||||
type: opts.type,
|
type: opts.type,
|
||||||
@ -47,9 +45,7 @@ class WarnInfraction extends Infraction
|
|||||||
if (!(opts.target instanceof MemberWrapper))
|
if (!(opts.target instanceof MemberWrapper))
|
||||||
throw new Error('Guild member required');
|
throw new Error('Guild member required');
|
||||||
this.member = opts.target;
|
this.member = opts.target;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async execute ()
|
async execute ()
|
||||||
@ -60,13 +56,11 @@ class WarnInfraction extends Infraction
|
|||||||
|
|
||||||
async verify ()
|
async verify ()
|
||||||
{
|
{
|
||||||
|
|
||||||
// NOTE: If I want to readd permission checking for escalations.
|
// NOTE: If I want to readd permission checking for escalations.
|
||||||
// const permissions = await this.client.permissions.execute(this.message, this.message.command);
|
// const permissions = await this.client.permissions.execute(this.message, this.message.command);
|
||||||
// if(permissions.error) return super._fail('COMMAND_WARN_INSUFFICIENTPERMISSIONS');
|
// if(permissions.error) return super._fail('COMMAND_WARN_INSUFFICIENTPERMISSIONS');
|
||||||
|
|
||||||
return super._verify();
|
return super._verify();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -81,8 +81,8 @@ class CommandOption
|
|||||||
throw new Error('Type cannot be an array here');
|
throw new Error('Type cannot be an array here');
|
||||||
this.#type = options.type ?? CommandOptionType.STRING;
|
this.#type = options.type ?? CommandOptionType.STRING;
|
||||||
this.#required = Boolean(options.required);
|
this.#required = Boolean(options.required);
|
||||||
this.#autocomplete = options.autocomplete || false;
|
this.#autocomplete = options.autocomplete ?? false;
|
||||||
this.#choices = options.choices || []; // Used for STRING/INTEGER/NUMBER types.
|
this.#choices = options.choices ?? []; // Used for STRING/INTEGER/NUMBER types.
|
||||||
|
|
||||||
this.#options = [];
|
this.#options = [];
|
||||||
if (options.options)
|
if (options.options)
|
||||||
@ -101,7 +101,7 @@ class CommandOption
|
|||||||
if (typeof options.maximum === 'number')
|
if (typeof options.maximum === 'number')
|
||||||
this.#maximum = options.maximum;
|
this.#maximum = options.maximum;
|
||||||
|
|
||||||
this.#slashOption = options.slashOption || false;
|
this.#slashOption = options.slashOption ?? false;
|
||||||
this.#flag = options.flag ?? false; // used with message based command options
|
this.#flag = options.flag ?? false; // used with message based command options
|
||||||
this.#valueOptional = options.valueOptional ?? false;
|
this.#valueOptional = options.valueOptional ?? false;
|
||||||
if (this.#valueOptional && typeof options.defaultValue === 'undefined')
|
if (this.#valueOptional && typeof options.defaultValue === 'undefined')
|
||||||
@ -112,7 +112,7 @@ class CommandOption
|
|||||||
// this.words = options.words ?? null; // Used when parsing strings if the command has multiple string types that aren't flags
|
// this.words = options.words ?? null; // Used when parsing strings if the command has multiple string types that aren't flags
|
||||||
|
|
||||||
// Used in cloned options when parsing final value
|
// Used in cloned options when parsing final value
|
||||||
this.#guild = options.guild || null;
|
this.#guild = options.guild ?? null;
|
||||||
this.#rawValue = options.rawValue ?? null; // Raw value input from Discord. -- use ?? where the value is potentially false, otherwise we end up with false -> null
|
this.#rawValue = options.rawValue ?? null; // Raw value input from Discord. -- use ?? where the value is potentially false, otherwise we end up with false -> null
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -291,7 +291,8 @@ class CommandOption
|
|||||||
continue;
|
continue;
|
||||||
if (PointsReg.test(str))
|
if (PointsReg.test(str))
|
||||||
{
|
{
|
||||||
value = num; removed = [ str ];
|
value = num;
|
||||||
|
removed = [ str ];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const index = this.#rawValue.indexOf(str);
|
const index = this.#rawValue.indexOf(str);
|
||||||
@ -299,7 +300,8 @@ class CommandOption
|
|||||||
const tmp = str + next;
|
const tmp = str + next;
|
||||||
if (PointsReg.test(tmp))
|
if (PointsReg.test(tmp))
|
||||||
{
|
{
|
||||||
value = num; removed = [ str, next ];
|
value = num;
|
||||||
|
removed = [ str, next ];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user