mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
20 lines
663 B
TypeScript
20 lines
663 B
TypeScript
import { rest } from "../../rest/rest.ts";
|
|
import { structures } from "../../structures/mod.ts";
|
|
import { endpoints } from "../../util/constants.ts";
|
|
import { requireBotGuildPermissions } from "../../util/permissions.ts";
|
|
|
|
/**
|
|
* Syncs the template to the guild's current state.
|
|
* Requires the `MANAGE_GUILD` permission.
|
|
*/
|
|
export async function syncGuildTemplate(guildId: string, templateCode: string) {
|
|
await requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]);
|
|
|
|
const template = (await rest.runMethod(
|
|
"put",
|
|
`${endpoints.GUILD_TEMPLATES(guildId)}/${templateCode}`,
|
|
)) as GuildTemplate;
|
|
|
|
return structures.createTemplateStruct(template);
|
|
}
|