diff --git a/src/structure/components/infractions/Addrole.js b/src/structure/components/infractions/Addrole.js index c9322b0..91141bf 100644 --- a/src/structure/components/infractions/Addrole.js +++ b/src/structure/components/infractions/Addrole.js @@ -8,27 +8,30 @@ class AddroleInfraction extends Infraction { constructor(client, opts = {}) { - super(client, { - targetType: 'USER', - type: opts.type, - guild: opts.guild, - channel: opts.channel, - invoker: opts.invoker, - target: opts.target.user, - executor: opts.executor.user, - reason: opts.reason, - arguments: opts.arguments, - silent: opts.silent, - duration: opts.duration, - points: opts.points, - expiration: opts.expiration, - data: opts.data, - hyperlink: opts.hyperlink - }); + if (opts.fetched) super(client, opts); + else { + super(client, { + targetType: 'USER', + type: opts.type, + guild: opts.guild, + channel: opts.channel, + invoker: opts.invoker, + target: opts.target.user, + executor: opts.executor.user, + reason: opts.reason, + arguments: opts.arguments, + silent: opts.silent, + duration: opts.duration, + points: opts.points, + expiration: opts.expiration, + data: opts.data, + hyperlink: opts.hyperlink + }); - if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); - this.member = opts.target; - this.executorMember = opts.executor; + if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); + this.member = opts.target; + this.executorMember = opts.executor; + } } diff --git a/src/structure/components/infractions/Kick.js b/src/structure/components/infractions/Kick.js index 8c34aa4..29f772b 100644 --- a/src/structure/components/infractions/Kick.js +++ b/src/structure/components/infractions/Kick.js @@ -7,25 +7,28 @@ class KickInfraction extends Infraction { constructor(client, opts = {}) { - super(client, { - targetType: 'USER', - type: opts.type, - invoker: opts.invoker, - executor: opts.executor.user, - target: opts.target.user, - reason: opts.reason, - guild: opts.guild, - channel: opts.channel, - arguments: opts.arguments, - silent: opts.silent, - points: opts.points, - expiration: opts.expiration, - data: opts.data, - hyperlink: opts.hyperlink - }); + if (opts.fetched) super(client, opts); + else { + super(client, { + targetType: 'USER', + type: opts.type, + invoker: opts.invoker, + executor: opts.executor.user, + target: opts.target.user, + reason: opts.reason, + guild: opts.guild, + channel: opts.channel, + arguments: opts.arguments, + silent: opts.silent, + points: opts.points, + expiration: opts.expiration, + data: opts.data, + hyperlink: opts.hyperlink + }); - if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); - this.member = opts.target; + if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); + this.member = opts.target; + } } diff --git a/src/structure/components/infractions/Lockdown.js b/src/structure/components/infractions/Lockdown.js index 11c8d79..75952aa 100644 --- a/src/structure/components/infractions/Lockdown.js +++ b/src/structure/components/infractions/Lockdown.js @@ -8,7 +8,8 @@ class LockdownInfraction extends Infraction { constructor(client, opts = {}) { - super(client, { + if (opts.fetched) super(client, opts); + else super(client, { targetType: 'CHANNEL', type: opts.type, invoker: opts.invoker, diff --git a/src/structure/components/infractions/Nickname.js b/src/structure/components/infractions/Nickname.js index 13e4af2..ede8c26 100644 --- a/src/structure/components/infractions/Nickname.js +++ b/src/structure/components/infractions/Nickname.js @@ -16,24 +16,27 @@ class NicknameInfraction extends Infraction { constructor(client, opts = {}) { - super(client, { - targetType: 'USER', - type: opts.type, - executor: opts.executor.user, - target: opts.target.user, - reason: opts.reason, - guild: opts.guild, - arguments: opts.arguments, - channel: opts.channel, - silent: opts.silent, - points: opts.points, - expiration: opts.expiration, - data: opts.data, - hyperlink: opts.hyperlink - }); + if (opts.fetched) super(client, opts); + else { + super(client, { + targetType: 'USER', + type: opts.type, + executor: opts.executor.user, + target: opts.target.user, + reason: opts.reason, + guild: opts.guild, + arguments: opts.arguments, + channel: opts.channel, + silent: opts.silent, + points: opts.points, + expiration: opts.expiration, + data: opts.data, + hyperlink: opts.hyperlink + }); - if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); - this.member = opts.target; + if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); + this.member = opts.target; + } } diff --git a/src/structure/components/infractions/Note.js b/src/structure/components/infractions/Note.js index b19914e..21cee3c 100644 --- a/src/structure/components/infractions/Note.js +++ b/src/structure/components/infractions/Note.js @@ -5,8 +5,9 @@ class NoteInfraction extends Infraction { static type = 'NOTE'; constructor(client, opts = {}) { - - super(client, { + + if (opts.fetched) super(client, opts); + else super(client, { targetType: 'USER', arguments: opts.arguments, type: opts.type, @@ -22,9 +23,6 @@ class NoteInfraction extends Infraction { hyperlink: opts.hyperlink }); - // if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); - // this.member = opts.target; - } async execute() { diff --git a/src/structure/components/infractions/Prune.js b/src/structure/components/infractions/Prune.js index 3afa397..d64f406 100644 --- a/src/structure/components/infractions/Prune.js +++ b/src/structure/components/infractions/Prune.js @@ -9,24 +9,27 @@ class PruneInfraction extends Infraction { constructor(client, opts = {}) { - super(client, { - targetType: 'CHANNEL', - type: opts.type, - invoker: opts.invoker, - arguments: opts.arguments, - executor: opts.executor.user, - target: opts.target, - reason: opts.reason, - guild: opts.guild, - channel: opts.channel, - silent: opts.silent, - points: opts.points, - expiration: opts.expiration, - data: opts.data, - hyperlink: opts.hyperlink - }); + if (opts.fetched) super(client, opts); + else { + super(client, { + targetType: 'CHANNEL', + type: opts.type, + invoker: opts.invoker, + arguments: opts.arguments, + executor: opts.executor.user, + target: opts.target, + reason: opts.reason, + guild: opts.guild, + channel: opts.channel, + silent: opts.silent, + points: opts.points, + expiration: opts.expiration, + data: opts.data, + hyperlink: opts.hyperlink + }); - this.channel = opts.target; + this.channel = opts.target; + } } diff --git a/src/structure/components/infractions/Removerole.js b/src/structure/components/infractions/Removerole.js index ab9b077..4ee85b1 100644 --- a/src/structure/components/infractions/Removerole.js +++ b/src/structure/components/infractions/Removerole.js @@ -8,27 +8,30 @@ class RemoveroleInfraction extends Infraction { constructor(client, opts = {}) { - super(client, { - targetType: 'USER', - type: opts.type, - invoker: opts.invoker, - executor: opts.executor.user, - target: opts.target.user, - reason: opts.reason, - guild: opts.guild, - channel: opts.channel, - arguments: opts.arguments, - silent: opts.silent, - duration: opts.duration, - points: opts.points, - expiration: opts.expiration, - data: opts.data, - hyperlink: opts.hyperlink - }); + if (opts.fetched) super(client, opts); + else { + super(client, { + targetType: 'USER', + type: opts.type, + invoker: opts.invoker, + executor: opts.executor.user, + target: opts.target.user, + reason: opts.reason, + guild: opts.guild, + channel: opts.channel, + arguments: opts.arguments, + silent: opts.silent, + duration: opts.duration, + points: opts.points, + expiration: opts.expiration, + data: opts.data, + hyperlink: opts.hyperlink + }); - if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); - this.member = opts.target; - this.executorMember = opts.executor; + if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); + this.member = opts.target; + this.executorMember = opts.executor; + } } diff --git a/src/structure/components/infractions/Slowmode.js b/src/structure/components/infractions/Slowmode.js index 5ef24cc..b52f3b0 100644 --- a/src/structure/components/infractions/Slowmode.js +++ b/src/structure/components/infractions/Slowmode.js @@ -7,7 +7,8 @@ class SlowmodeInfraction extends Infraction { constructor(client, opts = {}) { - super(client, { + if (opts.fetched) super(client, opts); + else super(client, { targetType: 'CHANNEL', type: opts.type, invoker: opts.invoker, diff --git a/src/structure/components/infractions/Softban.js b/src/structure/components/infractions/Softban.js index 585fbfb..5f97c3d 100644 --- a/src/structure/components/infractions/Softban.js +++ b/src/structure/components/infractions/Softban.js @@ -7,7 +7,8 @@ class SoftbanInfraction extends Infraction { constructor(client, opts = {}) { - super(client, { + if (opts.fetched) super(client, opts); + else super(client, { targetType: 'USER', type: opts.type, invoker: opts.invoker, diff --git a/src/structure/components/infractions/Unban.js b/src/structure/components/infractions/Unban.js index 69fe936..ee70c63 100644 --- a/src/structure/components/infractions/Unban.js +++ b/src/structure/components/infractions/Unban.js @@ -7,7 +7,8 @@ class UnbanInfraction extends Infraction { constructor(client, opts = {}) { - super(client, { + if (opts.fetched) super(client, opts); + else super(client, { targetType: 'USER', type: opts.type, invoker: opts.invoker, diff --git a/src/structure/components/infractions/Unlockdown.js b/src/structure/components/infractions/Unlockdown.js index 1c3cf4e..c87b316 100644 --- a/src/structure/components/infractions/Unlockdown.js +++ b/src/structure/components/infractions/Unlockdown.js @@ -6,7 +6,8 @@ class UnlockdownInfraction extends Infraction { constructor(client, opts = {}) { - super(client, { + if (opts.fetched) super(client, opts); + else super(client, { targetType: 'CHANNEL', type: opts.type, invoker: opts.invoker, @@ -20,6 +21,7 @@ class UnlockdownInfraction extends Infraction { data: opts.data, hyperlink: opts.hyperlink }); + } diff --git a/src/structure/components/infractions/Unmute.js b/src/structure/components/infractions/Unmute.js index 182bac1..369caa0 100644 --- a/src/structure/components/infractions/Unmute.js +++ b/src/structure/components/infractions/Unmute.js @@ -8,26 +8,29 @@ class UnmuteInfraction extends Infraction { constructor(client, opts = {}) { - super(client, { - targetType: 'USER', - type: opts.type, - invoker: opts.invoker, - executor: opts.executor.user, - target: opts.target.user, - reason: opts.reason, - guild: opts.guild, - channel: opts.channel, - arguments: opts.arguments, - silent: opts.silent, - duration: opts.duration, - hyperlink: opts.hyperlink, - points: opts.points, - expiration: opts.expiration, - data: opts.data - }); + if (opts.fetched) super(client, opts); + else { + super(client, { + targetType: 'USER', + type: opts.type, + invoker: opts.invoker, + executor: opts.executor.user, + target: opts.target.user, + reason: opts.reason, + guild: opts.guild, + channel: opts.channel, + arguments: opts.arguments, + silent: opts.silent, + duration: opts.duration, + hyperlink: opts.hyperlink, + points: opts.points, + expiration: opts.expiration, + data: opts.data + }); - if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); - this.member = opts.target; + if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); + this.member = opts.target; + } } diff --git a/src/structure/components/infractions/Vckick.js b/src/structure/components/infractions/Vckick.js index a46058b..7e57f80 100644 --- a/src/structure/components/infractions/Vckick.js +++ b/src/structure/components/infractions/Vckick.js @@ -7,25 +7,28 @@ class VckickInfraction extends Infraction { constructor(client, opts = {}) { - super(client, { - targetType: 'USER', - type: opts.type, - invoker: opts.invoker, - executor: opts.executor.user, - target: opts.target.user, - reason: opts.reason, - guild: opts.guild, - channel: opts.channel, - arguments: opts.arguments, - silent: opts.silent, - points: opts.points, - expiration: opts.expiration, - data: opts.data, - hyperlink: opts.hyperlink - }); + if (opts.fetched) super(client, opts); + else { + super(client, { + targetType: 'USER', + type: opts.type, + invoker: opts.invoker, + executor: opts.executor.user, + target: opts.target.user, + reason: opts.reason, + guild: opts.guild, + channel: opts.channel, + arguments: opts.arguments, + silent: opts.silent, + points: opts.points, + expiration: opts.expiration, + data: opts.data, + hyperlink: opts.hyperlink + }); - if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); - this.member = opts.target; + if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); + this.member = opts.target; + } } diff --git a/src/structure/components/infractions/Warn.js b/src/structure/components/infractions/Warn.js index 8b692eb..38a2aef 100644 --- a/src/structure/components/infractions/Warn.js +++ b/src/structure/components/infractions/Warn.js @@ -7,25 +7,30 @@ class WarnInfraction extends Infraction { constructor(client, opts = {}) { - super(client, { - targetType: 'USER', - type: opts.type, - invoker: opts.invoker, - arguments: opts.arguments, - executor: opts.executor.user, - target: opts.target.user, - reason: opts.reason, - guild: opts.guild, - channel: opts.channel, - silent: opts.silent, - points: opts.points, - expiration: opts.expiration, - data: opts.data, - hyperlink: opts.hyperlink - }); + if (opts.fetched) super(client, opts); + else { - if(!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); - this.member = opts.target; + super(client, { + targetType: 'USER', + type: opts.type, + invoker: opts.invoker, + arguments: opts.arguments, + executor: opts.executor.user, + target: opts.target.user, + reason: opts.reason, + guild: opts.guild, + channel: opts.channel, + silent: opts.silent, + points: opts.points, + expiration: opts.expiration, + data: opts.data, + hyperlink: opts.hyperlink + }); + + if (!(opts.target instanceof GuildMember)) throw new Error('Guild member required'); + this.member = opts.target; + + } } @@ -38,7 +43,7 @@ class WarnInfraction extends Infraction { // 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('C_WARN_INSUFFICIENTPERMISSIONS'); + // if(permissions.error) return super._fail('COMMAND_WARN_INSUFFICIENTPERMISSIONS'); return super._verify();