diff --git a/src/helpers/discovery/get_discovery_categories.ts b/src/helpers/discovery/get_discovery_categories.ts new file mode 100644 index 000000000..fab403a14 --- /dev/null +++ b/src/helpers/discovery/get_discovery_categories.ts @@ -0,0 +1,25 @@ +import { rest } from "../../rest/rest.ts"; +import { + DiscordDiscoveryCategory, + DiscoveryCategory, +} from "../../types/discovery/discovery_category.ts"; +import { Collection } from "../../util/collection.ts"; +import { endpoints } from "../../util/constants.ts"; +import { snakeKeysToCamelCase } from "../../util/utils.ts"; + +/** Returns an array of discovery category objects that can be used when editing guilds */ +export async function getDiscoveryCategories() { + const result = await rest.runMethod( + "get", + endpoints.DISCOVERY_CATEGORIES, + ); + + return new Collection( + result.map( + (category) => [ + category.id, + snakeKeysToCamelCase(category), + ] + ), + ); +}