mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-31 16:00:07 +00:00
23 lines
1.0 KiB
TypeScript
23 lines
1.0 KiB
TypeScript
import type { CreateGuild } from "../../types/guilds/createGuild.ts";
|
|
import type { Guild } from "../../types/guilds/guild.ts";
|
|
import type { Bot } from "../../bot.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(bot: Bot, options: CreateGuild) {
|
|
const result = await bot.rest.runMethod<Guild>(bot.rest, "post", bot.constants.endpoints.GUILDS, {
|
|
name: options.name,
|
|
afk_channel_id: options.afkChannelId,
|
|
afk_timeout: options.afkTimeout,
|
|
channels: options.channels,
|
|
default_message_notifications: options.defaultMessageNotifications,
|
|
explicit_content_filter: options.explicitContentFilter,
|
|
icon: options.icon,
|
|
roles: options.roles,
|
|
system_channel_flags: options.systemChannelFlags,
|
|
system_channel_id: options.systemChannelId,
|
|
verification_level: options.verificationLevel,
|
|
});
|
|
|
|
return bot.transformers.guild(bot, { guild: result, shardId: 0 });
|
|
}
|