From 55235e5ea06b0a5796ee963e7d957c564cc1e17f Mon Sep 17 00:00:00 2001 From: ITOH <72305210+itohatweb@users.noreply.github.com> Date: Sat, 23 Jan 2021 20:17:50 +0100 Subject: [PATCH] feat(handlers): add getTemplate() (#422) * feat(handlers): getTemplate * update jsdoc * redirect this function * remove getGuildTemplate * Update src/api/handlers/guild.ts Co-authored-by: Ayyan * remove breaking change * save in const * Update src/api/handlers/guild.ts Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> * Update src/api/handlers/guild.ts * Update src/api/handlers/guild.ts * Update mod.ts Co-authored-by: Ayyan Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> --- src/api/handlers/guild.ts | 16 +++++++++++++--- src/api/handlers/mod.ts | 2 ++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/api/handlers/guild.ts b/src/api/handlers/guild.ts index f290d4dc1..c57d6c810 100644 --- a/src/api/handlers/guild.ts +++ b/src/api/handlers/guild.ts @@ -772,13 +772,23 @@ export function getGuild(guildID: string, counts = true) { } /** Returns the guild template if it exists */ +export async function getTemplate(templateCode: string) { + const result = await RequestManager.get( + endpoints.GUILD_TEMPLATE(templateCode), + ) as GuildTemplate; + const template = await structures.createTemplate(result); + return template; +} + +/** + * Returns the guild template if it exists + * @deprecated will get removed in v11 use `getTemplate` instead + */ export function getGuildTemplate( guildID: string, templateCode: string, ) { - return RequestManager.get( - `${endpoints.GUILD_TEMPLATES(guildID)}/${templateCode}`, - ) as Promise