forked from Galactic/galactic-bot
Merge branch 'ts-rewrite' of https://git.corgi.wtf/Galactic/galactic-bot into ts-rewrite
This commit is contained in:
commit
2703460b84
@ -499,7 +499,6 @@ class ModerationManager implements Initialisable
|
||||
points, expiration, timestamp: response.infraction.timestamp, id: response.infraction.id
|
||||
});
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
async _handleArguments (invoker: InvokerWrapper, targets: ModerationTargets, args: {[key: string]: CommandOption | undefined})
|
||||
@ -614,9 +613,7 @@ class ModerationManager implements Initialisable
|
||||
}, callBackAt - currentDate),
|
||||
infraction
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async removeCallback (infraction: InfractionClass | InfractionJSON, updateCase = false)
|
||||
@ -668,7 +665,6 @@ class ModerationManager implements Initialisable
|
||||
|
||||
async findLatestInfraction (type: InfractionType, target: ModerationTarget)
|
||||
{
|
||||
|
||||
const callback = this.#callbacks.filter((c) =>
|
||||
{
|
||||
return c.infraction.type === type
|
||||
@ -683,7 +679,6 @@ class ModerationManager implements Initialisable
|
||||
{ sort: { timestamp: -1 } }
|
||||
);
|
||||
return result || null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -175,7 +175,6 @@ class LockdownInfraction extends Infraction
|
||||
|
||||
async verify ()
|
||||
{
|
||||
|
||||
const perms = (this.target as GuildChannel).permissionsFor(this.client.user!);
|
||||
const missing = perms?.missing([ 'ManageRoles', 'SendMessages', 'AddReactions', 'ViewChannel' ]);
|
||||
if (!perms || missing?.length)
|
||||
|
@ -191,7 +191,6 @@ class MuteInfraction extends Infraction
|
||||
return this._fail('COMMAND_MUTE_MISSING_MANAGEROLE_PERM');
|
||||
|
||||
return super._verify();
|
||||
|
||||
}
|
||||
|
||||
async resolve (_staff: UserWrapper, _reason: string, _notify: boolean): Promise<void | ResolveResult>
|
||||
@ -208,7 +207,6 @@ class MuteInfraction extends Infraction
|
||||
error = false;
|
||||
|
||||
const settings = await this.guild.settings();
|
||||
|
||||
const { removedRoles = [], muteType = settings.mute.type, muteRole = settings.mute.role } = this.data || {};
|
||||
// TODO: Change this to not rely on the member
|
||||
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)
|
||||
{
|
||||
|
||||
if (opts.fetched)
|
||||
super(client, logger, opts);
|
||||
else
|
||||
{
|
||||
|
||||
super(client, logger, {
|
||||
targetType: 'USER',
|
||||
type: opts.type,
|
||||
@ -47,9 +45,7 @@ class WarnInfraction extends Infraction
|
||||
if (!(opts.target instanceof MemberWrapper))
|
||||
throw new Error('Guild member required');
|
||||
this.member = opts.target;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async execute ()
|
||||
@ -60,13 +56,11 @@ class WarnInfraction extends Infraction
|
||||
|
||||
async verify ()
|
||||
{
|
||||
|
||||
// NOTE: If I want to readd permission checking for escalations.
|
||||
// const permissions = await this.client.permissions.execute(this.message, this.message.command);
|
||||
// if(permissions.error) return super._fail('COMMAND_WARN_INSUFFICIENTPERMISSIONS');
|
||||
|
||||
return super._verify();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ class CommandOption
|
||||
throw new Error('Type cannot be an array here');
|
||||
this.#type = options.type ?? CommandOptionType.STRING;
|
||||
this.#required = Boolean(options.required);
|
||||
this.#autocomplete = options.autocomplete || false;
|
||||
this.#choices = options.choices || []; // Used for STRING/INTEGER/NUMBER types.
|
||||
this.#autocomplete = options.autocomplete ?? false;
|
||||
this.#choices = options.choices ?? []; // Used for STRING/INTEGER/NUMBER types.
|
||||
|
||||
this.#options = [];
|
||||
if (options.options)
|
||||
@ -104,7 +104,7 @@ class CommandOption
|
||||
if (typeof this.#maximum === 'undefined' || this.#maximum > Number.MAX_SAFE_INTEGER)
|
||||
this.#maximum = Number.MAX_SAFE_INTEGER;
|
||||
|
||||
this.#slashOption = options.slashOption || false;
|
||||
this.#slashOption = options.slashOption ?? false;
|
||||
this.#flag = options.flag ?? false; // used with message based command options
|
||||
this.#valueOptional = options.valueOptional ?? false;
|
||||
if (this.#valueOptional && typeof options.defaultValue === 'undefined')
|
||||
@ -115,7 +115,7 @@ class CommandOption
|
||||
// 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
|
||||
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
|
||||
|
||||
}
|
||||
@ -294,7 +294,8 @@ class CommandOption
|
||||
continue;
|
||||
if (PointsReg.test(str))
|
||||
{
|
||||
value = num; removed = [ str ];
|
||||
value = num;
|
||||
removed = [ str ];
|
||||
break;
|
||||
}
|
||||
const index = this.#rawValue.indexOf(str);
|
||||
@ -302,7 +303,8 @@ class CommandOption
|
||||
const tmp = str + next;
|
||||
if (PointsReg.test(tmp))
|
||||
{
|
||||
value = num; removed = [ str, next ];
|
||||
value = num;
|
||||
removed = [ str, next ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user