diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2021-05-26 16:53:45 +0000 |
---|---|---|
committer | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2021-05-26 16:53:45 +0000 |
commit | 481a157a177e60f023b59e4e9acffc549760db40 (patch) | |
tree | e5ae3e5815c7b1135738d59645f4248219f7fcca /src/lib/extensions/Util.ts | |
parent | 53d8d5e551e9a239fd4c48c7dca4e1f6fb8d81e9 (diff) | |
download | tanzanite-481a157a177e60f023b59e4e9acffc549760db40.tar.gz tanzanite-481a157a177e60f023b59e4e9acffc549760db40.tar.bz2 tanzanite-481a157a177e60f023b59e4e9acffc549760db40.zip |
Automatically format code
Diffstat (limited to 'src/lib/extensions/Util.ts')
-rw-r--r-- | src/lib/extensions/Util.ts | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/src/lib/extensions/Util.ts b/src/lib/extensions/Util.ts index bd6823f..54df670 100644 --- a/src/lib/extensions/Util.ts +++ b/src/lib/extensions/Util.ts @@ -246,10 +246,13 @@ export class Util extends ClientUtil { } public async syncSlashCommands(force = false, guild?: string): Promise<void> { - let fetchedGuild: Guild + let fetchedGuild: Guild; if (guild) fetchedGuild = this.client.guilds.cache.get(guild); try { - const registered = guild === undefined ? await this.client.application.commands.fetch() : await fetchedGuild.commands.fetch(); + const registered = + guild === undefined + ? await this.client.application.commands.fetch() + : await fetchedGuild.commands.fetch(); for (const [, registeredCommand] of registered) { if ( !this.client.commandHandler.modules.find( @@ -257,9 +260,15 @@ export class Util extends ClientUtil { )?.execSlash || force ) { - guild === undefined ? await this.client.application.commands.delete(registeredCommand.id) : await fetchedGuild.commands.delete(registeredCommand.id); + guild === undefined + ? await this.client.application.commands.delete( + registeredCommand.id + ) + : await fetchedGuild.commands.delete(registeredCommand.id); this.client.logger.verbose( - chalk`{red Deleted slash command ${registeredCommand.name}${guild !== undefined ? ` in guild ${fetchedGuild.name}`:''}}` + chalk`{red Deleted slash command ${registeredCommand.name}${ + guild !== undefined ? ` in guild ${fetchedGuild.name}` : '' + }}` ); } } @@ -276,25 +285,44 @@ export class Util extends ClientUtil { if (found?.id && !force) { if (slashdata.description !== found.description) { - guild === undefined ? await this.client.application.commands.edit(found.id, slashdata) : fetchedGuild.commands.edit(found.id, slashdata); + guild === undefined + ? await this.client.application.commands.edit( + found.id, + slashdata + ) + : fetchedGuild.commands.edit(found.id, slashdata); this.client.logger.verbose( - chalk`{yellow Edited slash command ${botCommand.id}${guild !== undefined ? ` in guild ${fetchedGuild.name}`:''}}` + chalk`{yellow Edited slash command ${botCommand.id}${ + guild !== undefined ? ` in guild ${fetchedGuild.name}` : '' + }}` ); } } else { - guild === undefined ? await this.client.application.commands.create(slashdata) : fetchedGuild.commands.create(slashdata); + guild === undefined + ? await this.client.application.commands.create(slashdata) + : fetchedGuild.commands.create(slashdata); this.client.logger.verbose( - chalk`{green Created slash command ${botCommand.id}${guild !== undefined ? ` in guild ${fetchedGuild.name}`:''}}` + chalk`{green Created slash command ${botCommand.id}${ + guild !== undefined ? ` in guild ${fetchedGuild.name}` : '' + }}` ); } } } - return this.client.logger.log(chalk.green(`Slash commands registered${guild !== undefined ? ` in guild ${fetchedGuild.name}`:''}`)); + return this.client.logger.log( + chalk.green( + `Slash commands registered${ + guild !== undefined ? ` in guild ${fetchedGuild.name}` : '' + }` + ) + ); } catch (e) { console.log(chalk.red(e.stack)); return this.client.logger.error( - chalk`{red Slash commands not registered${guild !== undefined ? ` in guild ${fetchedGuild.name}`:''}, see above error.}` + chalk`{red Slash commands not registered${ + guild !== undefined ? ` in guild ${fetchedGuild.name}` : '' + }, see above error.}` ); } } |