fix: return types [] => Collection

This commit is contained in:
Skillz4Killz
2021-04-13 17:53:49 +00:00
committed by GitHub
parent f8d6a74948
commit c2f2afb211
8 changed files with 91 additions and 34 deletions
+8 -2
View File
@@ -3,6 +3,7 @@ import { structures } from "../../structures/mod.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { DiscordTemplate } from "../../types/templates/template.ts";
import { Collection } from "../../util/collection.ts";
/**
* Returns an array of templates.
@@ -13,8 +14,13 @@ export async function getGuildTemplates(guildId: string) {
const templates = (await rest.runMethod(
"get",
endpoints.GUILD_TEMPLATES(guildId),
endpoints.GUILD_TEMPLATES(guildId)
)) as DiscordTemplate[];
return templates.map((template) => structures.createTemplateStruct(template));
return new Collection(
templates.map((template) => [
template.code,
structures.createTemplateStruct(template),
])
);
}