mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
feat: add support for guild templates (#4907)
Co-authored-by: Noel <buechler.noel@outlook.com>
This commit is contained in:
33
typings/index.d.ts
vendored
33
typings/index.d.ts
vendored
@@ -214,6 +214,7 @@ declare module 'discord.js' {
|
||||
public fetchApplication(): Promise<ClientApplication>;
|
||||
public fetchGuildPreview(guild: GuildResolvable): Promise<GuildPreview>;
|
||||
public fetchInvite(invite: InviteResolvable): Promise<Invite>;
|
||||
public fetchGuildTemplate(template: GuildTemplateResolvable): Promise<GuildTemplate>;
|
||||
public fetchVoiceRegions(): Promise<Collection<string, VoiceRegion>>;
|
||||
public fetchWebhook(id: Snowflake, token?: string): Promise<Webhook>;
|
||||
public generateInvite(options?: InviteGenerationOptions | PermissionResolvable): Promise<string>;
|
||||
@@ -524,10 +525,12 @@ declare module 'discord.js' {
|
||||
|
||||
export class DataResolver {
|
||||
public static resolveBase64(data: Base64Resolvable): string;
|
||||
public static resolveCode(data: string, regx: RegExp): string;
|
||||
public static resolveFile(resource: BufferResolvable | Stream): Promise<Buffer | Stream>;
|
||||
public static resolveFileAsBuffer(resource: BufferResolvable | Stream): Promise<Buffer>;
|
||||
public static resolveImage(resource: BufferResolvable | Base64Resolvable): Promise<string>;
|
||||
public static resolveInviteCode(data: InviteResolvable): string;
|
||||
public static resolveGuildTemplateCode(data: GuildTemplateResolvable): string;
|
||||
}
|
||||
|
||||
export class DiscordAPIError extends Error {
|
||||
@@ -634,6 +637,7 @@ declare module 'discord.js' {
|
||||
public addMember(user: UserResolvable, options: AddGuildMemberOptions): Promise<GuildMember>;
|
||||
public bannerURL(options?: ImageURLOptions): string | null;
|
||||
public createIntegration(data: IntegrationData, reason?: string): Promise<Guild>;
|
||||
public createTemplate(name: string, description?: string): Promise<GuildTemplate>;
|
||||
public delete(): Promise<Guild>;
|
||||
public discoverySplashURL(options?: ImageURLOptions): string | null;
|
||||
public edit(data: GuildEditData, reason?: string): Promise<Guild>;
|
||||
@@ -646,6 +650,7 @@ declare module 'discord.js' {
|
||||
public fetchIntegrations(options?: FetchIntegrationsOptions): Promise<Collection<string, Integration>>;
|
||||
public fetchInvites(): Promise<Collection<string, Invite>>;
|
||||
public fetchPreview(): Promise<GuildPreview>;
|
||||
public fetchTemplates(): Promise<Collection<GuildTemplate['code'], GuildTemplate>>;
|
||||
public fetchVanityCode(): Promise<string>;
|
||||
public fetchVanityData(): Promise<{ code: string; uses: number }>;
|
||||
public fetchVoiceRegions(): Promise<Collection<string, VoiceRegion>>;
|
||||
@@ -852,6 +857,29 @@ declare module 'discord.js' {
|
||||
public toString(): string;
|
||||
}
|
||||
|
||||
export class GuildTemplate extends Base {
|
||||
constructor(client: Client, data: object);
|
||||
public readonly createdTimestamp: number;
|
||||
public readonly updatedTimestamp: number;
|
||||
public readonly url: string;
|
||||
public code: string;
|
||||
public name: string;
|
||||
public description: string | null;
|
||||
public usageCount: number;
|
||||
public creator: User;
|
||||
public creatorID: Snowflake;
|
||||
public createdAt: Date;
|
||||
public updatedAt: Date;
|
||||
public guild: Guild | null;
|
||||
public guildID: Snowflake;
|
||||
public serializedGuild: object;
|
||||
public unSynced: boolean | null;
|
||||
public createGuild(name: string, icon?: BufferResolvable | Base64Resolvable): Promise<Guild>;
|
||||
public delete(): Promise<GuildTemplate>;
|
||||
public edit(options?: { name?: string; description?: string }): Promise<GuildTemplate>;
|
||||
public sync(): Promise<GuildTemplate>;
|
||||
}
|
||||
|
||||
export class GuildPreviewEmoji extends BaseGuildEmoji {
|
||||
constructor(client: Client, data: object, guild: GuildPreview);
|
||||
public guild: GuildPreview;
|
||||
@@ -2101,6 +2129,7 @@ declare module 'discord.js' {
|
||||
UNKNOWN_EMOJI: 10014;
|
||||
UNKNOWN_WEBHOOK: 10015;
|
||||
UNKNOWN_BAN: 10026;
|
||||
UNKNOWN_GUILD_TEMPLATE: 10057;
|
||||
BOT_PROHIBITED_ENDPOINT: 20001;
|
||||
BOT_ONLY_ENDPOINT: 20002;
|
||||
CHANNEL_HIT_WRITE_RATELIMIT: 20028;
|
||||
@@ -2113,6 +2142,7 @@ declare module 'discord.js' {
|
||||
MAXIMUM_CHANNELS: 30013;
|
||||
MAXIMUM_ATTACHMENTS: 30015;
|
||||
MAXIMUM_INVITES: 30016;
|
||||
GUILD_ALREADY_HAS_TEMPLATE: 30031;
|
||||
UNAUTHORIZED: 40001;
|
||||
ACCOUNT_VERIFICATION_REQUIRED: 40002;
|
||||
REQUEST_ENTITY_TOO_LARGE: 40005;
|
||||
@@ -2637,6 +2667,7 @@ declare module 'discord.js' {
|
||||
host?: string;
|
||||
cdn?: string;
|
||||
invite?: string;
|
||||
template?: string;
|
||||
}
|
||||
|
||||
type ImageSize = 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096;
|
||||
@@ -2694,6 +2725,8 @@ declare module 'discord.js' {
|
||||
|
||||
type InviteResolvable = string;
|
||||
|
||||
type GuildTemplateResolvable = string;
|
||||
|
||||
type MembershipStates = 'INVITED' | 'ACCEPTED';
|
||||
|
||||
type MessageAdditions = MessageEmbed | MessageAttachment | (MessageEmbed | MessageAttachment)[];
|
||||
|
||||
Reference in New Issue
Block a user