mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-02 08:50:07 +00:00
Update get_discovery_categories.ts
This commit is contained in:
@@ -1,25 +1,18 @@
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import {
|
||||
DiscordDiscoveryCategory,
|
||||
DiscoveryCategory,
|
||||
} from "../../types/discovery/discovery_category.ts";
|
||||
import { 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<DiscordDiscoveryCategory[]>(
|
||||
const result = await rest.runMethod<DiscoveryCategory[]>(
|
||||
"get",
|
||||
endpoints.DISCOVERY_CATEGORIES,
|
||||
);
|
||||
|
||||
return new Collection<number, DiscoveryCategory>(
|
||||
result.map(
|
||||
(category) => [
|
||||
category.id,
|
||||
snakeKeysToCamelCase<DiscoveryCategory>(category),
|
||||
],
|
||||
(category) => [category.id, category],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user