create server

This commit is contained in:
Skillz
2020-09-24 12:03:43 -04:00
parent 5d274b90b6
commit 77b8dde667
3 changed files with 33 additions and 1 deletions
+7 -1
View File
@@ -19,6 +19,7 @@ import type {
ChannelCreateOptions,
BannedUser,
UserPayload,
CreateServerOptions,
} from "../types/guild.ts";
import type { RoleData } from "../types/role.ts";
import type { MemberCreatePayload } from "../types/member.ts";
@@ -38,6 +39,11 @@ import { structures } from "../structures/mod.ts";
import { cacheHandlers } from "../controllers/cache.ts";
import { formatImageURL } from "../utils/cdn.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 function createServer(options: CreateServerOptions) {
return RequestManager.post(endpoints.GUILDS, options);
}
/** Gets an array of all the channels ids that are the children of this category. */
export function categoryChildrenIDs(guild: Guild, id: string) {
return guild.channels.filter((channel) => channel.parentID === id);
@@ -99,7 +105,7 @@ export async function createGuildChannel(
name,
permission_overwrites: options?.permission_overwrites?.map((perm) => ({
...perm,
allow: perm.allow.reduce(
(bits, p) => bits |= BigInt(Permissions[p]),
BigInt(0),