oceanic.js
Version:
A NodeJS library for interfacing with Discord.
56 lines (55 loc) • 2.06 kB
TypeScript
/** @module GuildTemplate */
import type Guild from "./Guild";
import type User from "./User";
import type Client from "../Client";
import type { CreateGuildFromTemplateOptions, EditGuildTemplateOptions, RawGuildTemplate } from "../types/guild-template";
import type { RawGuild } from "../types/guilds";
import type { JSONGuildTemplate } from "../types/json";
/** Represents a guild template. */
export default class GuildTemplate {
private _cachedSourceGuild?;
client: Client;
/** The code of the template. */
code: string;
/** When this template was created. */
createdAt: Date;
/** The creator of this template. */
creator: User;
/** The description of this template. */
description: string | null;
/** If this template has unsynced changes. */
isDirty: boolean | null;
/** The name of this template. */
name: string;
/** A snapshot of the guild. */
serializedSourceGuild: Partial<RawGuild>;
/** The ID of the source guild of this template. */
sourceGuildID: string;
/** When this template was last updated. */
updatedAt: Date;
/** The amount of times this template has been used. */
usageCount: number;
constructor(data: RawGuildTemplate, client: Client);
protected update(data: Partial<RawGuildTemplate>): void;
/** The source guild of this template. This will throw an error if the guild is not cached. */
get sourceGuild(): Guild;
/**
* Create a guild from this template. This can only be used by bots in less than 10 guilds.
* @param options The options for creating the guild.
*/
createGuild(options: CreateGuildFromTemplateOptions): Promise<Guild>;
/**
* Delete this template.
*/
delete(): Promise<void>;
/**
* Edit this template.
* @param options The options for editing the template.
*/
editTemplate(options: EditGuildTemplateOptions): Promise<GuildTemplate>;
/**
* Sync this template.
*/
syncTemplate(): Promise<GuildTemplate>;
toJSON(): JSONGuildTemplate;
}