diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-17 20:03:05 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-17 20:03:05 -0400 |
commit | e1c613829950a534d9f45c00a033b83575be3b3c (patch) | |
tree | 2de1e5231217211ae4087c46cc74dc46c584507a /src/lib/extensions/discord.js | |
parent | 0e87bbd3940d89defcb04926587b35c8f4d1947f (diff) | |
download | tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.tar.gz tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.tar.bz2 tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.zip |
remove global client variable
Diffstat (limited to 'src/lib/extensions/discord.js')
-rw-r--r-- | src/lib/extensions/discord.js/ExtendedGuild.ts | 48 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/ExtendedGuildMember.ts | 77 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/ExtendedMessage.ts | 2 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/ExtendedUser.ts | 4 |
4 files changed, 85 insertions, 46 deletions
diff --git a/src/lib/extensions/discord.js/ExtendedGuild.ts b/src/lib/extensions/discord.js/ExtendedGuild.ts index c199899..c58916c 100644 --- a/src/lib/extensions/discord.js/ExtendedGuild.ts +++ b/src/lib/extensions/discord.js/ExtendedGuild.ts @@ -41,7 +41,7 @@ import _ from 'lodash'; import * as Moderation from '../../common/util/Moderation.js'; import { Guild as GuildDB } from '../../models/instance/Guild.js'; import { ModLogType } from '../../models/instance/ModLog.js'; -import { addOrRemoveFromArray, resolveNonCachedUser } from '../../utils/BushUtils.js'; +import { addOrRemoveFromArray } from '../../utils/BushUtils.js'; declare module 'discord.js' { export interface Guild { @@ -187,7 +187,7 @@ export class ExtendedGuild extends Guild { */ public override async getSetting<K extends keyof GuildModel>(setting: K): Promise<GuildModel[K]> { return ( - client.cache.guilds.get(this.id)?.[setting] ?? + this.client.cache.guilds.get(this.id)?.[setting] ?? ((await GuildDB.findByPk(this.id)) ?? GuildDB.build({ id: this.id }))[setting] ); } @@ -206,8 +206,8 @@ export class ExtendedGuild extends Guild { const row = (await GuildDB.findByPk(this.id)) ?? GuildDB.build({ id: this.id }); const oldValue = row[setting] as GuildDB[K]; row[setting] = value; - client.cache.guilds.set(this.id, row.toJSON() as GuildDB); - client.emit('bushUpdateSettings', setting, this, oldValue, row[setting], moderator); + this.client.cache.guilds.set(this.id, row.toJSON() as GuildDB); + this.client.emit('bushUpdateSettings', setting, this, oldValue, row[setting], moderator); return await row.save(); } @@ -253,7 +253,7 @@ export class ExtendedGuild extends Guild { * @param message The description of the error embed */ public override async error(title: string, message: string): Promise<void> { - void client.console.info(_.camelCase(title), message.replace(/\*\*(.*?)\*\*/g, '<<$1>>')); + void this.client.console.info(_.camelCase(title), message.replace(/\*\*(.*?)\*\*/g, '<<$1>>')); void this.sendLogChannel('error', { embeds: [{ title: title, description: message, color: colors.error }] }); } @@ -268,8 +268,8 @@ export class ExtendedGuild extends Guild { let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const user = await resolveNonCachedUser(options.user); - const moderator = client.users.resolve(options.moderator ?? client.user!); + const user = await this.client.utils.resolveNonCachedUser(options.user); + const moderator = this.client.users.resolve(options.moderator ?? this.client.user!); if (!user || !moderator) return banResponse.CANNOT_RESOLVE_USER; if ((await this.bans.fetch()).has(user.id)) return banResponse.ALREADY_BANNED; @@ -277,6 +277,7 @@ export class ExtendedGuild extends Guild { const ret = await (async () => { // add modlog entry const { log: modlog } = await Moderation.createModLogEntry({ + client: this.client, type: options.duration ? ModLogType.TEMP_BAN : ModLogType.PERM_BAN, user: user, moderator: moderator.id, @@ -290,6 +291,7 @@ export class ExtendedGuild extends Guild { // dm user dmSuccessEvent = await Moderation.punishDM({ + client: this.client, modlog: modlog.id, guild: this, user: user, @@ -310,6 +312,7 @@ export class ExtendedGuild extends Guild { // add punishment entry so they can be unbanned later const punishmentEntrySuccess = await Moderation.createPunishmentEntry({ + client: this.client, type: 'ban', user: user, guild: this, @@ -323,7 +326,7 @@ export class ExtendedGuild extends Guild { })(); if (!([banResponse.ACTION_ERROR, banResponse.MODLOG_ERROR, banResponse.PUNISHMENT_ENTRY_ADD_ERROR] as const).includes(ret)) - client.emit( + this.client.emit( 'bushBan', user, moderator, @@ -352,6 +355,7 @@ export class ExtendedGuild extends Guild { const ret = await (async () => { // add modlog entry const { log: modlog } = await Moderation.createModLogEntrySimple({ + client: this.client, type: ModLogType.PERM_BAN, user: options.user, moderator: options.moderator, @@ -365,6 +369,7 @@ export class ExtendedGuild extends Guild { // dm user if (this.members.cache.has(options.user)) { dmSuccessEvent = await Moderation.punishDM({ + client: this.client, modlog: modlog.id, guild: this, user: options.user, @@ -386,6 +391,7 @@ export class ExtendedGuild extends Guild { // add punishment entry so they can be unbanned later const punishmentEntrySuccess = await Moderation.createPunishmentEntry({ + client: this.client, type: 'ban', user: options.user, guild: this, @@ -411,8 +417,8 @@ export class ExtendedGuild extends Guild { let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const user = await resolveNonCachedUser(options.user); - const moderator = client.users.resolve(options.moderator ?? client.user!); + const user = await this.client.utils.resolveNonCachedUser(options.user); + const moderator = this.client.users.resolve(options.moderator ?? this.client.user!); if (!user || !moderator) return unbanResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -435,6 +441,7 @@ export class ExtendedGuild extends Guild { // add modlog entry const { log: modlog } = await Moderation.createModLogEntry({ + client: this.client, type: ModLogType.UNBAN, user: user.id, moderator: moderator.id, @@ -447,6 +454,7 @@ export class ExtendedGuild extends Guild { // remove punishment entry const removePunishmentEntrySuccess = await Moderation.removePunishmentEntry({ + client: this.client, type: 'ban', user: user.id, guild: this @@ -455,6 +463,7 @@ export class ExtendedGuild extends Guild { // dm user dmSuccessEvent = await Moderation.punishDM({ + client: this.client, guild: this, user: user, punishment: 'unbanned', @@ -470,7 +479,16 @@ export class ExtendedGuild extends Guild { ret ) ) - client.emit('bushUnban', user, moderator, this, options.reason ?? undefined, caseID!, dmSuccessEvent!, options.evidence); + this.client.emit( + 'bushUnban', + user, + moderator, + this, + options.reason ?? undefined, + caseID!, + dmSuccessEvent!, + options.evidence + ); return ret; } @@ -549,7 +567,7 @@ export class ExtendedGuild extends Guild { else return `success: ${success.filter((c) => c === true).size}`; })(); - client.emit(options.unlock ? 'bushUnlockdown' : 'bushLockdown', moderator, options.reason, success, options.all); + this.client.emit(options.unlock ? 'bushUnlockdown' : 'bushLockdown', moderator, options.reason, success, options.all); return ret; } @@ -557,7 +575,7 @@ export class ExtendedGuild extends Guild { if (!channel.isTextBased() || channel.isDMBased() || channel.guildId !== this.id || !this.members.me) return null; if (!channel.permissionsFor(this.members.me).has('ManageWebhooks')) return null; - const quote = new Message(client, rawQuote); + const quote = new Message(this.client, rawQuote); const target = channel instanceof ThreadChannel ? channel.parent : channel; if (!target) return null; @@ -570,8 +588,8 @@ export class ExtendedGuild extends Guild { if (!webhook) webhook = await target .createWebhook({ - name: `${client.user!.username} Quotes #${target.name}`, - avatar: client.user!.displayAvatarURL({ size: 2048 }), + name: `${this.client.user!.username} Quotes #${target.name}`, + avatar: this.client.user!.displayAvatarURL({ size: 2048 }), reason: 'Creating a webhook for quoting' }) .catch(() => null); diff --git a/src/lib/extensions/discord.js/ExtendedGuildMember.ts b/src/lib/extensions/discord.js/ExtendedGuildMember.ts index ad29236..947f9cd 100644 --- a/src/lib/extensions/discord.js/ExtendedGuildMember.ts +++ b/src/lib/extensions/discord.js/ExtendedGuildMember.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -import { BushClientEvents, formatError, Moderation, ModLogType, PunishmentTypeDM, resolveNonCachedUser, Time } from '#lib'; +import { BushClientEvents, formatError, Moderation, ModLogType, PunishmentTypeDM, Time } from '#lib'; import { ChannelType, GuildChannelResolvable, @@ -129,6 +129,7 @@ export class ExtendedGuildMember extends GuildMember { sendFooter = true ): Promise<boolean> { return Moderation.punishDM({ + client: this.client, modlog, guild: this.guild, user: this, @@ -148,13 +149,14 @@ export class ExtendedGuildMember extends GuildMember { public override async bushWarn(options: BushPunishmentOptions): Promise<{ result: WarnResponse; caseNum: number | null }> { let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await resolveNonCachedUser(options.moderator ?? this.guild.members.me); + const moderator = await this.client.utils.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return { result: warnResponse.CANNOT_RESOLVE_USER, caseNum: null }; const ret = await (async (): Promise<{ result: WarnResponse; caseNum: number | null }> => { // add modlog entry const result = await Moderation.createModLogEntry( { + client: this.client, type: ModLogType.WARN, user: this, moderator: moderator.id, @@ -178,7 +180,7 @@ export class ExtendedGuildMember extends GuildMember { return { result: warnResponse.SUCCESS, caseNum: result.caseNum }; })(); if (!([warnResponse.MODLOG_ERROR] as const).includes(ret.result) && !options.silent) - client.emit('bushWarn', this, moderator, this.guild, options.reason ?? undefined, caseID!, dmSuccessEvent!); + this.client.emit('bushWarn', this, moderator, this.guild, options.reason ?? undefined, caseID!, dmSuccessEvent!); return ret; } @@ -195,12 +197,13 @@ export class ExtendedGuildMember extends GuildMember { if (ifShouldAddRole !== true) return ifShouldAddRole; let caseID: string | undefined = undefined; - const moderator = await resolveNonCachedUser(options.moderator ?? this.guild.members.me); + const moderator = await this.client.utils.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return addRoleResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { if (options.addToModlog || options.duration) { const { log: modlog } = await Moderation.createModLogEntry({ + client: this.client, type: options.duration ? ModLogType.TEMP_PUNISHMENT_ROLE : ModLogType.PERM_PUNISHMENT_ROLE, guild: this.guild, moderator: moderator.id, @@ -216,6 +219,7 @@ export class ExtendedGuildMember extends GuildMember { if (options.addToModlog || options.duration) { const punishmentEntrySuccess = await Moderation.createPunishmentEntry({ + client: this.client, type: 'role', user: this, guild: this.guild, @@ -239,7 +243,7 @@ export class ExtendedGuildMember extends GuildMember { options.addToModlog && !options.silent ) - client.emit( + this.client.emit( 'bushPunishRole', this, moderator, @@ -266,12 +270,13 @@ export class ExtendedGuildMember extends GuildMember { if (ifShouldAddRole !== true) return ifShouldAddRole; let caseID: string | undefined = undefined; - const moderator = await resolveNonCachedUser(options.moderator ?? this.guild.members.me); + const moderator = await this.client.utils.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return removeRoleResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { if (options.addToModlog) { const { log: modlog } = await Moderation.createModLogEntry({ + client: this.client, type: ModLogType.REMOVE_PUNISHMENT_ROLE, guild: this.guild, moderator: moderator.id, @@ -285,6 +290,7 @@ export class ExtendedGuildMember extends GuildMember { caseID = modlog.id; const punishmentEntrySuccess = await Moderation.removePunishmentEntry({ + client: this.client, type: 'role', user: this, guild: this.guild, @@ -311,7 +317,7 @@ export class ExtendedGuildMember extends GuildMember { options.addToModlog && !options.silent ) - client.emit( + this.client.emit( 'bushPunishRoleRemove', this, moderator, @@ -362,7 +368,7 @@ export class ExtendedGuildMember extends GuildMember { let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await resolveNonCachedUser(options.moderator ?? this.guild.members.me); + const moderator = await this.client.utils.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return muteResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -370,14 +376,15 @@ export class ExtendedGuildMember extends GuildMember { const muteSuccess = await this.roles .add(muteRole, `[Mute] ${moderator.tag} | ${options.reason ?? 'No reason provided.'}`) .catch(async (e) => { - await client.console.warn('muteRoleAddError', e); - client.console.debug(e); + await this.client.console.warn('muteRoleAddError', e); + this.client.console.debug(e); return false; }); if (!muteSuccess) return muteResponse.ACTION_ERROR; // add modlog entry const { log: modlog } = await Moderation.createModLogEntry({ + client: this.client, type: options.duration ? ModLogType.TEMP_MUTE : ModLogType.PERM_MUTE, user: this, moderator: moderator.id, @@ -393,6 +400,7 @@ export class ExtendedGuildMember extends GuildMember { // add punishment entry so they can be unmuted later const punishmentEntrySuccess = await Moderation.createPunishmentEntry({ + client: this.client, type: 'mute', user: this, guild: this.guild, @@ -416,7 +424,7 @@ export class ExtendedGuildMember extends GuildMember { !([muteResponse.ACTION_ERROR, muteResponse.MODLOG_ERROR, muteResponse.PUNISHMENT_ENTRY_ADD_ERROR] as const).includes(ret) && !options.silent ) - client.emit( + this.client.emit( 'bushMute', this, moderator, @@ -448,7 +456,7 @@ export class ExtendedGuildMember extends GuildMember { let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await resolveNonCachedUser(options.moderator ?? this.guild.members.me); + const moderator = await this.client.utils.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return unmuteResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -456,13 +464,14 @@ export class ExtendedGuildMember extends GuildMember { const muteSuccess = await this.roles .remove(muteRole, `[Unmute] ${moderator.tag} | ${options.reason ?? 'No reason provided.'}`) .catch(async (e) => { - await client.console.warn('muteRoleAddError', formatError(e, true)); + await this.client.console.warn('muteRoleAddError', formatError(e, true)); return false; }); if (!muteSuccess) return unmuteResponse.ACTION_ERROR; // add modlog entry const { log: modlog } = await Moderation.createModLogEntry({ + client: this.client, type: ModLogType.UNMUTE, user: this, moderator: moderator.id, @@ -477,6 +486,7 @@ export class ExtendedGuildMember extends GuildMember { // remove mute entry const removePunishmentEntrySuccess = await Moderation.removePunishmentEntry({ + client: this.client, type: 'mute', user: this, guild: this.guild @@ -500,7 +510,7 @@ export class ExtendedGuildMember extends GuildMember { ).includes(ret) && !options.silent ) - client.emit( + this.client.emit( 'bushUnmute', this, moderator, @@ -526,11 +536,12 @@ export class ExtendedGuildMember extends GuildMember { let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await resolveNonCachedUser(options.moderator ?? this.guild.members.me); + const moderator = await this.client.utils.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return kickResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { // add modlog entry const { log: modlog } = await Moderation.createModLogEntry({ + client: this.client, type: ModLogType.KICK, user: this, moderator: moderator.id, @@ -554,7 +565,7 @@ export class ExtendedGuildMember extends GuildMember { return kickResponse.SUCCESS; })(); if (!([kickResponse.ACTION_ERROR, kickResponse.MODLOG_ERROR] as const).includes(ret) && !options.silent) - client.emit( + this.client.emit( 'bushKick', this, moderator, @@ -580,7 +591,7 @@ export class ExtendedGuildMember extends GuildMember { let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await resolveNonCachedUser(options.moderator ?? this.guild.members.me); + const moderator = await this.client.utils.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return banResponse.CANNOT_RESOLVE_USER; // ignore result, they should still be banned even if their mute cannot be removed @@ -593,6 +604,7 @@ export class ExtendedGuildMember extends GuildMember { const ret = await (async () => { // add modlog entry const { log: modlog } = await Moderation.createModLogEntry({ + client: this.client, type: options.duration ? ModLogType.TEMP_BAN : ModLogType.PERM_BAN, user: this, moderator: moderator.id, @@ -620,6 +632,7 @@ export class ExtendedGuildMember extends GuildMember { // add punishment entry so they can be unbanned later const punishmentEntrySuccess = await Moderation.createPunishmentEntry({ + client: this.client, type: 'ban', user: this, guild: this.guild, @@ -635,7 +648,7 @@ export class ExtendedGuildMember extends GuildMember { !([banResponse.ACTION_ERROR, banResponse.MODLOG_ERROR, banResponse.PUNISHMENT_ENTRY_ADD_ERROR] as const).includes(ret) && !options.silent ) - client.emit( + this.client.emit( 'bushBan', this, moderator, @@ -663,7 +676,7 @@ export class ExtendedGuildMember extends GuildMember { let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await resolveNonCachedUser(options.moderator ?? this.guild.members.me); + const moderator = await this.client.utils.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return blockResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -677,6 +690,7 @@ export class ExtendedGuildMember extends GuildMember { // add modlog entry const { log: modlog } = await Moderation.createModLogEntry({ + client: this.client, type: options.duration ? ModLogType.TEMP_CHANNEL_BLOCK : ModLogType.PERM_CHANNEL_BLOCK, user: this, moderator: moderator.id, @@ -690,6 +704,7 @@ export class ExtendedGuildMember extends GuildMember { // add punishment entry so they can be unblocked later const punishmentEntrySuccess = await Moderation.createPunishmentEntry({ + client: this.client, type: 'block', user: this, guild: this.guild, @@ -703,6 +718,7 @@ export class ExtendedGuildMember extends GuildMember { const dmSuccess = options.silent ? null : await Moderation.punishDM({ + client: this.client, punishment: 'blocked', reason: options.reason ?? undefined, duration: options.duration ?? 0, @@ -724,7 +740,7 @@ export class ExtendedGuildMember extends GuildMember { ) && !options.silent ) - client.emit( + this.client.emit( 'bushBlock', this, moderator, @@ -754,7 +770,7 @@ export class ExtendedGuildMember extends GuildMember { let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await resolveNonCachedUser(options.moderator ?? this.guild.members.me); + const moderator = await this.client.utils.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return unblockResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -768,6 +784,7 @@ export class ExtendedGuildMember extends GuildMember { // add modlog entry const { log: modlog } = await Moderation.createModLogEntry({ + client: this.client, type: ModLogType.CHANNEL_UNBLOCK, user: this, moderator: moderator.id, @@ -781,6 +798,7 @@ export class ExtendedGuildMember extends GuildMember { // remove punishment entry const punishmentEntrySuccess = await Moderation.removePunishmentEntry({ + client: this.client, type: 'block', user: this, guild: this.guild, @@ -792,6 +810,7 @@ export class ExtendedGuildMember extends GuildMember { const dmSuccess = options.silent ? null : await Moderation.punishDM({ + client: this.client, punishment: 'unblocked', reason: options.reason ?? undefined, guild: this.guild, @@ -812,7 +831,7 @@ export class ExtendedGuildMember extends GuildMember { !([unblockResponse.ACTION_ERROR, unblockResponse.MODLOG_ERROR, unblockResponse.ACTION_ERROR] as const).includes(ret) && !options.silent ) - client.emit( + this.client.emit( 'bushUnblock', this, moderator, @@ -839,7 +858,7 @@ export class ExtendedGuildMember extends GuildMember { let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await resolveNonCachedUser(options.moderator ?? this.guild.members.me); + const moderator = await this.client.utils.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return timeoutResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -852,6 +871,7 @@ export class ExtendedGuildMember extends GuildMember { // add modlog entry const { log: modlog } = await Moderation.createModLogEntry({ + client: this.client, type: ModLogType.TIMEOUT, user: this, moderator: moderator.id, @@ -876,7 +896,7 @@ export class ExtendedGuildMember extends GuildMember { })(); if (!([timeoutResponse.ACTION_ERROR, timeoutResponse.MODLOG_ERROR] as const).includes(ret) && !options.silent) - client.emit( + this.client.emit( 'bushTimeout', this, moderator, @@ -901,7 +921,7 @@ export class ExtendedGuildMember extends GuildMember { let caseID: string | undefined = undefined; let dmSuccessEvent: boolean | undefined = undefined; - const moderator = await resolveNonCachedUser(options.moderator ?? this.guild.members.me); + const moderator = await this.client.utils.resolveNonCachedUser(options.moderator ?? this.guild.members.me); if (!moderator) return removeTimeoutResponse.CANNOT_RESOLVE_USER; const ret = await (async () => { @@ -913,6 +933,7 @@ export class ExtendedGuildMember extends GuildMember { // add modlog entry const { log: modlog } = await Moderation.createModLogEntry({ + client: this.client, type: ModLogType.REMOVE_TIMEOUT, user: this, moderator: moderator.id, @@ -936,7 +957,7 @@ export class ExtendedGuildMember extends GuildMember { })(); if (!([removeTimeoutResponse.ACTION_ERROR, removeTimeoutResponse.MODLOG_ERROR] as const).includes(ret) && !options.silent) - client.emit( + this.client.emit( 'bushRemoveTimeout', this, moderator, @@ -953,14 +974,14 @@ export class ExtendedGuildMember extends GuildMember { * Whether or not the user is an owner of the bot. */ public override isOwner(): boolean { - return client.isOwner(this); + return this.client.isOwner(this); } /** * Whether or not the user is a super user of the bot. */ public override isSuperUser(): boolean { - return client.isSuperUser(this); + return this.client.isSuperUser(this); } } diff --git a/src/lib/extensions/discord.js/ExtendedMessage.ts b/src/lib/extensions/discord.js/ExtendedMessage.ts index 4431077..0d8ce37 100644 --- a/src/lib/extensions/discord.js/ExtendedMessage.ts +++ b/src/lib/extensions/discord.js/ExtendedMessage.ts @@ -7,6 +7,6 @@ export class ExtendedMessage<Cached extends boolean = boolean> extends Message<C public constructor(client_: Client, data: RawMessageData) { super(client_, data); - this.util = new CommandUtil(client.commandHandler, this); + this.util = new CommandUtil(this.client.commandHandler, this); } } diff --git a/src/lib/extensions/discord.js/ExtendedUser.ts b/src/lib/extensions/discord.js/ExtendedUser.ts index 556ab85..23de523 100644 --- a/src/lib/extensions/discord.js/ExtendedUser.ts +++ b/src/lib/extensions/discord.js/ExtendedUser.ts @@ -23,13 +23,13 @@ export class ExtendedUser extends User { * Indicates whether the user is an owner of the bot. */ public override isOwner(): boolean { - return client.isOwner(this); + return this.client.isOwner(this); } /** * Indicates whether the user is a superuser of the bot. */ public override isSuperUser(): boolean { - return client.isSuperUser(this); + return this.client.isSuperUser(this); } } |