swc/bundler/tests/.cache/deno/a2af37659e6a590305032727c17d8c504d79880d.ts
강동윤 d60c3242af
fix(swc): Fix bugs (#1739)
swc_bundler:
 - Fix cycle detection for complex circular imports. (denoland/deno#10752)

swc_ecma_transforms_typescript:
 - Allow using large values for an enum variant.
2021-05-25 14:30:17 +09:00

25 lines
1.0 KiB
TypeScript

// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/guilds/create_guild.ts
import { botId } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import type { CreateGuild } from "../../types/guilds/create_guild.ts";
import type { Guild } from "../../types/guilds/guild.ts";
import { endpoints } from "../../util/constants.ts";
import { getMember } from "../members/get_member.ts";
/** Create a new guild. Returns a guild object on success. Fires a Guild Create Gateway event. This endpoint can be used only by bots in less than 10 guilds. */
export async function createGuild(options: CreateGuild) {
const result = await rest.runMethod<Guild>("post", endpoints.GUILDS, options);
const guild = await structures.createDiscordenoGuild(result, 0);
// MANUALLY CACHE THE GUILD
await cacheHandlers.set("guilds", guild.id, guild);
// MANUALLY CACHE THE BOT
await getMember(guild.id, botId);
return guild;
}