diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-26 18:47:13 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-26 18:47:13 -0400 |
commit | 80d5b5b11ae261945dc725a0a80115922003afcf (patch) | |
tree | 16c9f251b4d53456b4b5340c0203d35fd5870859 /src/lib/extensions/discord.js | |
parent | cca0b7a03bcd61af12b7f9bff51276f6c70beeb3 (diff) | |
download | tanzanite-80d5b5b11ae261945dc725a0a80115922003afcf.tar.gz tanzanite-80d5b5b11ae261945dc725a0a80115922003afcf.tar.bz2 tanzanite-80d5b5b11ae261945dc725a0a80115922003afcf.zip |
refactor: this.client -> client
Diffstat (limited to 'src/lib/extensions/discord.js')
-rw-r--r-- | src/lib/extensions/discord.js/BushGuild.ts | 10 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushGuildMember.ts | 20 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushMessage.ts | 2 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushUser.ts | 4 |
4 files changed, 18 insertions, 18 deletions
diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index 0e4891e..9d618ec 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -13,7 +13,7 @@ export class BushGuild extends Guild { public async getSetting<K extends keyof GuildModel>(setting: K): Promise<GuildModel[K]> { return ( - this.client.cache.guilds.get(this.id)?.[setting] ?? + client.cache.guilds.get(this.id)?.[setting] ?? ((await GuildDB.findByPk(this.id)) ?? GuildDB.build({ id: this.id }))[setting] ); } @@ -21,7 +21,7 @@ export class BushGuild extends Guild { public async setSetting<K extends keyof GuildModel>(setting: K, value: GuildDB[K]): Promise<GuildDB> { const row = (await GuildDB.findByPk(this.id)) ?? GuildDB.build({ id: this.id }); row[setting] = value; - this.client.cache.guilds.set(this.id, row.toJSON() as GuildDB); + client.cache.guilds.set(this.id, row.toJSON() as GuildDB); return await row.save(); } @@ -37,8 +37,8 @@ export class BushGuild extends Guild { | 'error creating modlog entry' | 'error removing ban entry' > { - const user = this.client.users.resolveId(options.user); - const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator)); + const user = client.users.resolveId(options.user); + const moderator = client.users.cache.get(client.users.resolveId(options.moderator)); const bans = await this.bans.fetch(); @@ -76,7 +76,7 @@ export class BushGuild extends Guild { .catch(() => null); if (!removePunishmentEntrySuccess) return 'error removing ban entry'; - const userObject = this.client.users.cache.get(user); + const userObject = client.users.cache.get(user); userObject?.send(`You have been unbanned from **${this}** for **${options.reason || 'No reason provided'}**.`); diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts index c04c8f0..70feb90 100644 --- a/src/lib/extensions/discord.js/BushGuildMember.ts +++ b/src/lib/extensions/discord.js/BushGuildMember.ts @@ -80,7 +80,7 @@ export class BushGuildMember extends GuildMember { } public async warn(options: BushPunishmentOptions): Promise<{ result: WarnResponse; caseNum: number }> { - const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator || this.client.user)); + const moderator = client.users.cache.get(client.users.resolveId(options.moderator || client.user)); // add modlog entry const result = await util .createModLogEntry( @@ -94,7 +94,7 @@ export class BushGuildMember extends GuildMember { true ) .catch((e) => { - this.client.console.error('warn', e, true, 1); + client.console.error('warn', e, true, 1); return { log: null, caseNum: null }; }); if (!result || !result.log) return { result: 'error creating modlog entry', caseNum: null }; @@ -116,7 +116,7 @@ export class BushGuildMember extends GuildMember { const ifShouldAddRole = this.checkIfShouldAddRole(options.role); if (ifShouldAddRole !== true) return ifShouldAddRole; - const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator || this.client.user)); + const moderator = client.users.cache.get(client.users.resolveId(options.moderator || client.user)); if (options.addToModlog) { const { log: modlog } = await util @@ -153,7 +153,7 @@ export class BushGuildMember extends GuildMember { const ifShouldAddRole = this.checkIfShouldAddRole(options.role); if (ifShouldAddRole !== true) return ifShouldAddRole; - const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator || this.client.user)); + const moderator = client.users.cache.get(client.users.resolveId(options.moderator || client.user)); if (options.addToModlog) { const { log: modlog } = await util @@ -203,7 +203,7 @@ export class BushGuildMember extends GuildMember { if (!muteRole) return 'invalid mute role'; if (muteRole.position >= this.guild.me.roles.highest.position || muteRole.managed) return 'mute role not manageable'; - const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator || this.client.user)); + const moderator = client.users.cache.get(client.users.resolveId(options.moderator || client.user)); // add role const muteSuccess = await this.roles @@ -258,7 +258,7 @@ export class BushGuildMember extends GuildMember { if (!muteRole) return 'invalid mute role'; if (muteRole.position >= this.guild.me.roles.highest.position || muteRole.managed) return 'mute role not manageable'; - const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator || this.client.user)); + const moderator = client.users.cache.get(client.users.resolveId(options.moderator || client.user)); //remove role const muteSuccess = await this.roles @@ -302,7 +302,7 @@ export class BushGuildMember extends GuildMember { // checks if (!this.guild.me.permissions.has('KICK_MEMBERS') || !this.kickable) return 'missing permissions'; - const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator || this.client.user)); + const moderator = client.users.cache.get(client.users.resolveId(options.moderator || client.user)); // dm user const ending = await this.guild.getSetting('punishmentEnding'); @@ -335,7 +335,7 @@ export class BushGuildMember extends GuildMember { // checks if (!this.guild.me.permissions.has('BAN_MEMBERS') || !this.bannable) return 'missing permissions'; - const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator || this.client.user)); + const moderator = client.users.cache.get(client.users.resolveId(options.moderator || client.user)); // dm user const ending = await this.guild.getSetting('punishmentEnding'); @@ -382,10 +382,10 @@ export class BushGuildMember extends GuildMember { } public get isOwner(): boolean { - return this.client.isOwner(this); + return client.isOwner(this); } public get isSuperUser(): boolean { - return this.client.isSuperUser(this); + return client.isSuperUser(this); } } diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts index d4b47c6..68f3de0 100644 --- a/src/lib/extensions/discord.js/BushMessage.ts +++ b/src/lib/extensions/discord.js/BushMessage.ts @@ -21,6 +21,6 @@ export class BushMessage extends Message { channel: BushTextChannel | BushDMChannel | BushNewsChannel | BushThreadChannel ) { super(client, data, channel); - // this.util = new BushCommandUtil(this.client.commandHandler, this); + // this.util = new BushCommandUtil(client.commandHandler, this); } } diff --git a/src/lib/extensions/discord.js/BushUser.ts b/src/lib/extensions/discord.js/BushUser.ts index 53a6be3..54a67b5 100644 --- a/src/lib/extensions/discord.js/BushUser.ts +++ b/src/lib/extensions/discord.js/BushUser.ts @@ -10,10 +10,10 @@ export class BushUser extends User { } public isOwner(): boolean { - return this.client.isOwner(this); + return client.isOwner(this); } public isSuperUser(): boolean { - return this.client.isSuperUser(this); + return client.isSuperUser(this); } } |