mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
Create add_discovery_subcategory.ts
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
import { rest } from "../../rest/rest.ts";
|
||||||
|
import {
|
||||||
|
AddGuildDiscoverySubcategory,
|
||||||
|
DiscordAddGuildDiscoverySubcategory,
|
||||||
|
} from "../../types/discovery/add_guild_discovery_subcategory.ts";
|
||||||
|
import { endpoints } from "../../util/constants.ts";
|
||||||
|
import { requireBotGuildPermissions } from "../../util/permissions.ts";
|
||||||
|
import { snakeKeysToCamelCase } from "../../util/utils.ts";
|
||||||
|
|
||||||
|
/** Add a discovery subcategory to the guild. Requires the `MANAGE_GUILD` permission. */
|
||||||
|
export async function addDiscoverySubcategory(
|
||||||
|
guildId: string,
|
||||||
|
categoryId: number,
|
||||||
|
) {
|
||||||
|
await requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]);
|
||||||
|
|
||||||
|
const result = await rest.runMethod<DiscordAddGuildDiscoverySubcategory>(
|
||||||
|
"post",
|
||||||
|
endpoints.DISCOVERY_SUBCATEGORY(guildId, categoryId),
|
||||||
|
);
|
||||||
|
|
||||||
|
return snakeKeysToCamelCase<AddGuildDiscoverySubcategory>(result);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user