diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-05 13:45:44 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-05 13:45:44 -0400 |
commit | 81d69f983983ac71dbdbd5f13e2f2d8ddc35dced (patch) | |
tree | 6a06124a6696bb4036607d179972aa889b7b3769 /src/lib/extensions/discord.js | |
parent | 93e8fce44ec1dd3294b1c785d93d3f8b00ee4cef (diff) | |
download | tanzanite-81d69f983983ac71dbdbd5f13e2f2d8ddc35dced.tar.gz tanzanite-81d69f983983ac71dbdbd5f13e2f2d8ddc35dced.tar.bz2 tanzanite-81d69f983983ac71dbdbd5f13e2f2d8ddc35dced.zip |
cleaning up and some imporvements to the stats command
Diffstat (limited to 'src/lib/extensions/discord.js')
-rw-r--r-- | src/lib/extensions/discord.js/BushGuild.ts | 2 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushGuildMember.ts | 11 |
2 files changed, 6 insertions, 7 deletions
diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index 12db49a..efecdcd 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -37,7 +37,6 @@ export class BushGuild extends Guild { } public async getSetting<K extends keyof GuildModel>(setting: K): Promise<GuildModel[K]> { - // client.console.debug(`getSetting: ${setting}`); return ( client.cache.guilds.get(this.id)?.[setting] ?? ((await GuildDB.findByPk(this.id)) ?? GuildDB.build({ id: this.id }))[setting] @@ -45,7 +44,6 @@ export class BushGuild extends Guild { } public async setSetting<K extends keyof GuildModel>(setting: K, value: GuildDB[K]): Promise<GuildDB> { - // client.console.debug(`setSetting: ${setting}`); const row = (await GuildDB.findByPk(this.id)) ?? GuildDB.build({ id: this.id }); row[setting] = value; client.cache.guilds.set(this.id, row.toJSON() as GuildDB); diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts index 2c41873..ab4eee4 100644 --- a/src/lib/extensions/discord.js/BushGuildMember.ts +++ b/src/lib/extensions/discord.js/BushGuildMember.ts @@ -93,8 +93,12 @@ export class BushGuildMember extends GuildMember { : undefined; const dmSuccess = await this.send({ content: `You have been ${punishment} in **${this.guild.name}** ${ - duration !== null || duration !== undefined ? (duration ? `for ${util.humanizeDuration(duration)}` : 'permanently') : '' - }for **${reason ?? 'No reason provided'}**.${ending ? `\n\n${ending}` : ''}`, + duration !== null && duration !== undefined + ? duration + ? `for ${util.humanizeDuration(duration)} ` + : 'permanently ' + : '' + }for **${reason?.trim() ?? 'No reason provided'}**.`, embeds: dmEmbed ? [dmEmbed] : undefined }).catch(() => false); return !!dmSuccess; @@ -124,7 +128,6 @@ export class BushGuildMember extends GuildMember { } public async addRole(options: AddRoleOptions): Promise<AddRoleResponse> { - client.console.debug(`addRole: ${options.role.name}`); const ifShouldAddRole = this.#checkIfShouldAddRole(options.role); if (ifShouldAddRole !== true) return ifShouldAddRole; @@ -144,7 +147,6 @@ export class BushGuildMember extends GuildMember { if (!modlog && options.addToModlog) return 'error creating modlog entry'; if (options.addToModlog || options.duration) { - client.console.debug('got to punishment'); const punishmentEntrySuccess = await util.createPunishmentEntry({ type: 'role', user: this, @@ -164,7 +166,6 @@ export class BushGuildMember extends GuildMember { } public async removeRole(options: RemoveRoleOptions): Promise<RemoveRoleResponse> { - client.console.debug(`removeRole: ${options.role.name}`); const ifShouldAddRole = this.#checkIfShouldAddRole(options.role); if (ifShouldAddRole !== true) return ifShouldAddRole; |