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 */
|
/** 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(
|
export function getGuildTemplate(
|
||||||
guildID: string,
|
guildID: string,
|
||||||
templateCode: string,
|
templateCode: string,
|
||||||
) {
|
) {
|
||||||
return RequestManager.get(
|
return getTemplate(templateCode);
|
||||||
`${endpoints.GUILD_TEMPLATES(guildID)}/${templateCode}`,
|
|
||||||
) as Promise<Template>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ import {
|
|||||||
getMembersByQuery,
|
getMembersByQuery,
|
||||||
getPruneCount,
|
getPruneCount,
|
||||||
getRoles,
|
getRoles,
|
||||||
|
getTemplate,
|
||||||
getUser,
|
getUser,
|
||||||
getVanityURL,
|
getVanityURL,
|
||||||
getVoiceRegions,
|
getVoiceRegions,
|
||||||
@@ -176,6 +177,7 @@ export let handlers = {
|
|||||||
getIntegrations,
|
getIntegrations,
|
||||||
getInvites,
|
getInvites,
|
||||||
getMember,
|
getMember,
|
||||||
|
getTemplate,
|
||||||
getMembersByQuery,
|
getMembersByQuery,
|
||||||
getPruneCount,
|
getPruneCount,
|
||||||
getRoles,
|
getRoles,
|
||||||
|
|||||||
Reference in New Issue
Block a user