forked from Galactic/galactic-bot
catch errors
This commit is contained in:
parent
8c6ba57db4
commit
ddd695084a
@ -73,7 +73,7 @@ class BanInfraction extends Infraction
|
|||||||
|
|
||||||
async verify ()
|
async verify ()
|
||||||
{
|
{
|
||||||
const member = await this.guild.resolveMember(this.target!.id);
|
const member = await this.guild.resolveMember(this.target!.id).catch(() => null);
|
||||||
if (member && !member.bannable)
|
if (member && !member.bannable)
|
||||||
return super._fail('C_BAN_CANNOTBEBANNED');
|
return super._fail('C_BAN_CANNOTBEBANNED');
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class SoftbanInfraction extends Infraction
|
|||||||
{
|
{
|
||||||
await this.guild.members.ban(this.target!.id, {
|
await this.guild.members.ban(this.target!.id, {
|
||||||
reason: this._reason,
|
reason: this._reason,
|
||||||
deleteMessageDays: days
|
deleteMessageSeconds: days * 24 * 60 * 60
|
||||||
});
|
});
|
||||||
await this.guild.members.unban(this.target!.id, this._reason);
|
await this.guild.members.unban(this.target!.id, this._reason);
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ class CommandOption
|
|||||||
throw new Error('Invalid rawValue');
|
throw new Error('Invalid rawValue');
|
||||||
for (const arg of this.#rawValue)
|
for (const arg of this.#rawValue)
|
||||||
{
|
{
|
||||||
const member = await this.#guild.resolveMember(arg, this.strict);
|
const member = await this.#guild.resolveMember(arg, this.strict).catch(() => null);
|
||||||
if (member)
|
if (member)
|
||||||
{
|
{
|
||||||
members.push(member);
|
members.push(member);
|
||||||
@ -618,7 +618,7 @@ class CommandOption
|
|||||||
throw new Error('Missing guild');
|
throw new Error('Missing guild');
|
||||||
if (typeof this.#rawValue !== 'string')
|
if (typeof this.#rawValue !== 'string')
|
||||||
throw new Error('Invalid rawValue');
|
throw new Error('Invalid rawValue');
|
||||||
const member = await this.#guild.resolveMember(this.#rawValue, this.strict);
|
const member = await this.#guild.resolveMember(this.#rawValue, this.strict).catch(() => null);
|
||||||
if (!member)
|
if (!member)
|
||||||
return { error: true };
|
return { error: true };
|
||||||
return { value: member, removed: [ this.#rawValue ] };
|
return { value: member, removed: [ this.#rawValue ] };
|
||||||
|
@ -874,7 +874,7 @@ class Infraction
|
|||||||
else if (type)
|
else if (type)
|
||||||
{
|
{
|
||||||
if (Util.isMemberResolveable(target))
|
if (Util.isMemberResolveable(target))
|
||||||
fetched = await this.#guild.memberWrapper(target); // await this.#client.resolver.resolveMember(target, this.#guild, true);
|
fetched = await this.#guild.memberWrapper(target).catch(() => null); // await this.#client.resolver.resolveMember(target, this.#guild, true);
|
||||||
if (!fetched && Util.isUserResolveable(target))
|
if (!fetched && Util.isUserResolveable(target))
|
||||||
fetched = await this.#client.getUserWrapper(target); // await this.#client.resolver.resolveUser(target, true);
|
fetched = await this.#client.getUserWrapper(target); // await this.#client.resolver.resolveUser(target, true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user