mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user