From 252fe62b72d26fe604ec11f97e433f13a3b3020c Mon Sep 17 00:00:00 2001 From: TriForMine Date: Mon, 18 Oct 2021 19:21:33 +0000 Subject: [PATCH] change: prettier code --- .../discovery/add_discovery_subcategory.ts | 10 +++++----- src/helpers/discovery/edit_discovery.ts | 19 ++++++++++++------- src/helpers/discovery/get_discovery.ts | 10 +++++++--- .../discovery/get_discovery_categories.ts | 14 ++++++++++---- .../discovery/remove_discovery_subcategory.ts | 8 ++++++-- src/helpers/discovery/valid_discovery_term.ts | 10 +++++++--- 6 files changed, 47 insertions(+), 24 deletions(-) diff --git a/src/helpers/discovery/add_discovery_subcategory.ts b/src/helpers/discovery/add_discovery_subcategory.ts index fa5020979..b442ac23d 100644 --- a/src/helpers/discovery/add_discovery_subcategory.ts +++ b/src/helpers/discovery/add_discovery_subcategory.ts @@ -1,14 +1,14 @@ import type { AddGuildDiscoverySubcategory } from "../../types/discovery/add_guild_discovery_subcategory.ts"; -import {Bot} from "../../bot.ts"; -import {SnakeCasedPropertiesDeep} from "../../types/util.ts"; +import { Bot } from "../../bot.ts"; +import { SnakeCasedPropertiesDeep } from "../../types/util.ts"; /** Add a discovery subcategory to the guild. Requires the `MANAGE_GUILD` permission. */ export async function addDiscoverySubcategory(bot: Bot, guildId: bigint, categoryId: number) { await bot.utils.requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]); return await bot.rest.runMethod>( - bot.rest, - "post", - bot.constants.endpoints.DISCOVERY_SUBCATEGORY(guildId, categoryId) + bot.rest, + "post", + bot.constants.endpoints.DISCOVERY_SUBCATEGORY(guildId, categoryId) ); } diff --git a/src/helpers/discovery/edit_discovery.ts b/src/helpers/discovery/edit_discovery.ts index dad432f7f..015149a53 100644 --- a/src/helpers/discovery/edit_discovery.ts +++ b/src/helpers/discovery/edit_discovery.ts @@ -1,15 +1,20 @@ import type { DiscoveryMetadata } from "../../types/discovery/discovery_metadata.ts"; import type { ModifyGuildDiscoveryMetadata } from "../../types/discovery/modify_guild_discovery_metadata.ts"; -import {SnakeCasedPropertiesDeep} from "../../types/util.ts"; -import {Bot} from "../../bot.ts"; +import { SnakeCasedPropertiesDeep } from "../../types/util.ts"; +import { Bot } from "../../bot.ts"; /** Modify the discovery metadata for the guild. Requires the MANAGE_GUILD permission. Returns the updated discovery metadata object on success. */ export async function editDiscovery(bot: Bot, guildId: bigint, data: ModifyGuildDiscoveryMetadata) { await bot.utils.requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]); - return await bot.rest.runMethod>(bot.rest,"patch", bot.constants.endpoints.DISCOVERY_METADATA(guildId), { - primary_category_id: data.primaryCategoryId, - keywords: data.keywords, - emoji_discoverability_enabled: data.emojiDiscoverabilityEnabled, - }); + return await bot.rest.runMethod>( + bot.rest, + "patch", + bot.constants.endpoints.DISCOVERY_METADATA(guildId), + { + primary_category_id: data.primaryCategoryId, + keywords: data.keywords, + emoji_discoverability_enabled: data.emojiDiscoverabilityEnabled, + } + ); } diff --git a/src/helpers/discovery/get_discovery.ts b/src/helpers/discovery/get_discovery.ts index c94913e0e..985d28882 100644 --- a/src/helpers/discovery/get_discovery.ts +++ b/src/helpers/discovery/get_discovery.ts @@ -1,10 +1,14 @@ import type { DiscoveryMetadata } from "../../types/discovery/discovery_metadata.ts"; -import {SnakeCasedPropertiesDeep} from "../../types/util.ts"; -import {Bot} from "../../bot.ts"; +import { SnakeCasedPropertiesDeep } from "../../types/util.ts"; +import { Bot } from "../../bot.ts"; /** Returns the discovery metadata object for the guild. Requires the `MANAGE_GUILD` permission. */ export async function getDiscovery(bot: Bot, guildId: bigint) { await bot.utils.requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]); - return await bot.rest.runMethod>(bot.rest,"get", bot.constants.endpoints.DISCOVERY_METADATA(guildId)); + return await bot.rest.runMethod>( + bot.rest, + "get", + bot.constants.endpoints.DISCOVERY_METADATA(guildId) + ); } diff --git a/src/helpers/discovery/get_discovery_categories.ts b/src/helpers/discovery/get_discovery_categories.ts index e47f7ddb8..b6a991c96 100644 --- a/src/helpers/discovery/get_discovery_categories.ts +++ b/src/helpers/discovery/get_discovery_categories.ts @@ -1,11 +1,17 @@ import type { DiscoveryCategory } from "../../types/discovery/discovery_category.ts"; import { Collection } from "../../util/collection.ts"; -import {Bot} from "../../bot.ts"; -import {SnakeCasedPropertiesDeep} from "../../types/util.ts"; +import { Bot } from "../../bot.ts"; +import { SnakeCasedPropertiesDeep } from "../../types/util.ts"; /** Returns a Collection (mapped by Id of the discovery category object) of discovery category objects that can be used when editing guilds */ export async function getDiscoveryCategories(bot: Bot) { - const result = await bot.rest.runMethod[]>(bot.rest,"get", bot.constants.endpoints.DISCOVERY_CATEGORIES); + const result = await bot.rest.runMethod[]>( + bot.rest, + "get", + bot.constants.endpoints.DISCOVERY_CATEGORIES + ); - return new Collection>(result.map((category) => [category.id, category])); + return new Collection>( + result.map((category) => [category.id, category]) + ); } diff --git a/src/helpers/discovery/remove_discovery_subcategory.ts b/src/helpers/discovery/remove_discovery_subcategory.ts index 7d989e07e..5abafb24d 100644 --- a/src/helpers/discovery/remove_discovery_subcategory.ts +++ b/src/helpers/discovery/remove_discovery_subcategory.ts @@ -1,8 +1,12 @@ -import {Bot} from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Removes a discovery subcategory from the guild. Requires the MANAGE_GUILD permission. Returns a 204 No Content on success. */ export async function removeDiscoverySubcategory(bot: Bot, guildId: bigint, categoryId: number) { await bot.utils.requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]); - return await bot.rest.runMethod(bot.rest,"delete", bot.constants.endpoints.DISCOVERY_SUBCATEGORY(guildId, categoryId)); + return await bot.rest.runMethod( + bot.rest, + "delete", + bot.constants.endpoints.DISCOVERY_SUBCATEGORY(guildId, categoryId) + ); } diff --git a/src/helpers/discovery/valid_discovery_term.ts b/src/helpers/discovery/valid_discovery_term.ts index 054bf142b..7c8a278b4 100644 --- a/src/helpers/discovery/valid_discovery_term.ts +++ b/src/helpers/discovery/valid_discovery_term.ts @@ -1,9 +1,13 @@ import type { ValidateDiscoverySearchTerm } from "../../types/discovery/validate_discovery_search_term.ts"; -import {Bot} from "../../bot.ts"; -import {SnakeCasedPropertiesDeep} from "../../types/util.ts"; +import { Bot } from "../../bot.ts"; +import { SnakeCasedPropertiesDeep } from "../../types/util.ts"; export async function validDiscoveryTerm(bot: Bot, term: string) { - const result = await bot.rest.runMethod>("get", bot.constants.endpoints.DISCOVERY_VALID_TERM, { term }); + const result = await bot.rest.runMethod>( + "get", + bot.constants.endpoints.DISCOVERY_VALID_TERM, + { term } + ); return result.valid; }