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 <ayyantee@gmail.com>

* 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 <ayyantee@gmail.com>
Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
This commit is contained in:
ITOH
2021-01-23 20:17:50 +01:00
committed by GitHub
parent f6f435bb1f
commit 55235e5ea0
2 changed files with 15 additions and 3 deletions
+13 -3
View File
@@ -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<Template>;
return getTemplate(templateCode);
}
/**
+2
View File
@@ -58,6 +58,7 @@ import {
getMembersByQuery,
getPruneCount,
getRoles,
getTemplate,
getUser,
getVanityURL,
getVoiceRegions,
@@ -176,6 +177,7 @@ export let handlers = {
getIntegrations,
getInvites,
getMember,
getTemplate,
getMembersByQuery,
getPruneCount,
getRoles,