diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-26 18:45:31 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-26 18:45:31 -0400 |
commit | cca0b7a03bcd61af12b7f9bff51276f6c70beeb3 (patch) | |
tree | 2b2adebc166ac033520e5b582773e63fbdc5ddb9 /src/lib | |
parent | 13ba1ad552047eb9386e91d542a975c4bef58b08 (diff) | |
download | tanzanite-cca0b7a03bcd61af12b7f9bff51276f6c70beeb3.tar.gz tanzanite-cca0b7a03bcd61af12b7f9bff51276f6c70beeb3.tar.bz2 tanzanite-cca0b7a03bcd61af12b7f9bff51276f6c70beeb3.zip |
refactor: this.client.util -> util
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/extensions/discord.js/BushGuild.ts | 4 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushGuildMember.ts | 28 | ||||
-rw-r--r-- | src/lib/utils/BushLogger.ts | 14 | ||||
-rw-r--r-- | src/lib/utils/Config.ts | 6 |
4 files changed, 26 insertions, 26 deletions
diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index 79f7c98..0e4891e 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -55,7 +55,7 @@ export class BushGuild extends Guild { if (!unbanSuccess) return 'error unbanning'; // add modlog entry - const modlog = await this.client.util + const modlog = await util .createModLogEntry({ type: ModLogType.UNBAN, user, @@ -67,7 +67,7 @@ export class BushGuild extends Guild { if (!modlog) return 'error creating modlog entry'; // remove punishment entry - const removePunishmentEntrySuccess = await this.client.util + const removePunishmentEntrySuccess = await util .removePunishmentEntry({ type: 'ban', user, diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts index 50875cc..c04c8f0 100644 --- a/src/lib/extensions/discord.js/BushGuildMember.ts +++ b/src/lib/extensions/discord.js/BushGuildMember.ts @@ -82,7 +82,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)); // add modlog entry - const result = await this.client.util + const result = await util .createModLogEntry( { type: ModLogType.WARN, @@ -119,7 +119,7 @@ export class BushGuildMember extends GuildMember { const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator || this.client.user)); if (options.addToModlog) { - const { log: modlog } = await this.client.util + const { log: modlog } = await util .createModLogEntry({ type: options.duration ? ModLogType.TEMP_PUNISHMENT_ROLE : ModLogType.PERM_PUNISHMENT_ROLE, guild: this.guild, @@ -130,7 +130,7 @@ export class BushGuildMember extends GuildMember { .catch(() => null); if (!modlog) return 'error creating modlog entry'; - const punishmentEntrySuccess = await this.client.util + const punishmentEntrySuccess = await util .createPunishmentEntry({ type: 'role', user: this, @@ -156,7 +156,7 @@ export class BushGuildMember extends GuildMember { const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator || this.client.user)); if (options.addToModlog) { - const { log: modlog } = await this.client.util + const { log: modlog } = await util .createModLogEntry({ type: ModLogType.PERM_PUNISHMENT_ROLE, guild: this.guild, @@ -167,7 +167,7 @@ export class BushGuildMember extends GuildMember { .catch(() => null); if (!modlog) return 'error creating modlog entry'; - const punishmentEntrySuccess = await this.client.util + const punishmentEntrySuccess = await util .removePunishmentEntry({ type: 'role', user: this, @@ -212,7 +212,7 @@ export class BushGuildMember extends GuildMember { if (!muteSuccess) return 'error giving mute role'; // add modlog entry - const { log: modlog } = await this.client.util + const { log: modlog } = await util .createModLogEntry({ type: options.duration ? ModLogType.TEMP_MUTE : ModLogType.PERM_MUTE, user: this, @@ -225,7 +225,7 @@ export class BushGuildMember extends GuildMember { if (!modlog) return 'error creating modlog entry'; // add punishment entry so they can be unmuted later - const punishmentEntrySuccess = await this.client.util + const punishmentEntrySuccess = await util .createPunishmentEntry({ type: 'mute', user: this, @@ -240,7 +240,7 @@ export class BushGuildMember extends GuildMember { const ending = await this.guild.getSetting('punishmentEnding'); const dmSuccess = await this.send({ content: `You have been muted ${ - options.duration ? 'for ' + this.client.util.humanizeDuration(options.duration) : 'permanently' + options.duration ? 'for ' + util.humanizeDuration(options.duration) : 'permanently' } in **${this.guild}** for **${options.reason || 'No reason provided'}**.${ending ? `\n\n${ending}` : ''}` }).catch(() => null); @@ -267,7 +267,7 @@ export class BushGuildMember extends GuildMember { if (!muteSuccess) return 'error removing mute role'; //remove modlog entry - const { log: modlog } = await this.client.util + const { log: modlog } = await util .createModLogEntry({ type: ModLogType.UNMUTE, user: this, @@ -279,7 +279,7 @@ export class BushGuildMember extends GuildMember { if (!modlog) return 'error creating modlog entry'; // remove mute entry - const removePunishmentEntrySuccess = await this.client.util + const removePunishmentEntrySuccess = await util .removePunishmentEntry({ type: 'mute', user: this, @@ -317,7 +317,7 @@ export class BushGuildMember extends GuildMember { if (!kickSuccess) return 'error kicking'; // add modlog entry - const { log: modlog } = await this.client.util + const { log: modlog } = await util .createModLogEntry({ type: ModLogType.KICK, user: this, @@ -341,7 +341,7 @@ export class BushGuildMember extends GuildMember { const ending = await this.guild.getSetting('punishmentEnding'); const dmSuccess = await this.send({ content: `You have been banned ${ - options.duration ? 'for ' + this.client.util.humanizeDuration(options.duration) : 'permanently' + options.duration ? 'for ' + util.humanizeDuration(options.duration) : 'permanently' } from **${this.guild}** for **${options.reason || 'No reason provided'}**.${ending ? `\n\n${ending}` : ''}` }).catch(() => null); @@ -353,7 +353,7 @@ export class BushGuildMember extends GuildMember { if (!banSuccess) return 'error banning'; // add modlog entry - const { log: modlog } = await this.client.util + const { log: modlog } = await util .createModLogEntry({ type: options.duration ? ModLogType.TEMP_BAN : ModLogType.PERM_BAN, user: this, @@ -366,7 +366,7 @@ export class BushGuildMember extends GuildMember { if (!modlog) return 'error creating modlog entry'; // add punishment entry so they can be unbanned later - const punishmentEntrySuccess = await this.client.util + const punishmentEntrySuccess = await util .createPunishmentEntry({ type: 'ban', user: this, diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts index 98c3c04..3069dc8 100644 --- a/src/lib/utils/BushLogger.ts +++ b/src/lib/utils/BushLogger.ts @@ -70,13 +70,13 @@ export class BushLogger { /** Sends a message to the log channel */ public async channelLog(message: BushSendMessageType): Promise<void> { - const channel = await this.client.util.getConfigChannel('log'); + const channel = await util.getConfigChannel('log'); await channel.send(message).catch(() => {}); } /** Sends a message to the error channel */ public async channelError(message: BushSendMessageType): Promise<void> { - const channel = await this.client.util.getConfigChannel('error'); + const channel = await util.getConfigChannel('error'); await channel.send(message).catch(() => {}); } @@ -116,7 +116,7 @@ export class BushLogger { if (!sendChannel) return; const embed = new MessageEmbed() .setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`) - .setColor(this.client.util.colors.gray) + .setColor(util.colors.gray) .setTimestamp(); await this.channelLog({ embeds: [embed] }); } @@ -137,7 +137,7 @@ export class BushLogger { if (!sendChannel) return; const embed = new MessageEmbed() .setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`) - .setColor(this.client.util.colors.info) + .setColor(util.colors.info) .setTimestamp(); await this.channelLog({ embeds: [embed] }); } @@ -159,7 +159,7 @@ export class BushLogger { if (!sendChannel) return; const embed = new MessageEmbed() .setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`) - .setColor(this.client.util.colors.warn) + .setColor(util.colors.warn) .setTimestamp(); await this.channelLog({ embeds: [embed] }); } @@ -180,7 +180,7 @@ export class BushLogger { if (!sendChannel) return; const embed = new MessageEmbed() .setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`) - .setColor(this.client.util.colors.error) + .setColor(util.colors.error) .setTimestamp(); await this.channelError({ embeds: [embed] }); } @@ -201,7 +201,7 @@ export class BushLogger { if (!sendChannel) return; const embed = new MessageEmbed() .setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`) - .setColor(this.client.util.colors.success) + .setColor(util.colors.success) .setTimestamp(); await this.channelLog({ embeds: [embed] }).catch(() => {}); } diff --git a/src/lib/utils/Config.ts b/src/lib/utils/Config.ts index 65f43cb..663fe95 100644 --- a/src/lib/utils/Config.ts +++ b/src/lib/utils/Config.ts @@ -8,7 +8,7 @@ export interface ConfigOptions { channels: { log: Snowflake; error: Snowflake; dm: Snowflake }; db: { host: string; port: number; username: string; password: string }; logging: { db: boolean; verbose: boolean; info: boolean }; - supportGuild: {id: Snowflake, invite: string} + supportGuild: { id: Snowflake; invite: string }; } export class Config { @@ -19,7 +19,7 @@ export class Config { public channels: { log: Snowflake; error: Snowflake; dm: Snowflake }; public db: { host: string; port: number; username: string; password: string }; public logging: { db: boolean; verbose: boolean; info: boolean }; - public supportGuild: {id: Snowflake, invite: string} + public supportGuild: { id: Snowflake; invite: string }; public constructor(options: ConfigOptions) { this.credentials = options.credentials; @@ -29,7 +29,7 @@ export class Config { this.channels = options.channels; this.db = options.db; this.logging = options.logging; - this.supportGuild = options.supportGuild + this.supportGuild = options.supportGuild; } public get token(): string { |