diff --git a/packages/discord.js/src/structures/Guild.js b/packages/discord.js/src/structures/Guild.js index edc63c7e9c3c..f370e606e678 100644 --- a/packages/discord.js/src/structures/Guild.js +++ b/packages/discord.js/src/structures/Guild.js @@ -1434,29 +1434,6 @@ class Guild extends AnonymousGuild { return this; } - /** - * Sets the guild's MFA level - * An elevated MFA level requires guild moderators to have 2FA enabled. - * - * @param {GuildMFALevel} level The MFA level - * @param {string} [reason] Reason for changing the guild's MFA level - * @returns {Promise} - * @example - * // Set the MFA level of the guild to Elevated - * guild.setMFALevel(GuildMFALevel.Elevated) - * .then(guild => console.log("Set guild's MFA level to Elevated")) - * .catch(console.error); - */ - async setMFALevel(level, reason) { - await this.client.rest.post(Routes.guildMFA(this.id), { - body: { - level, - }, - reason, - }); - return this; - } - /** * Leaves the guild. * @@ -1473,21 +1450,6 @@ class Guild extends AnonymousGuild { return this; } - /** - * Deletes the guild. - * - * @returns {Promise} - * @example - * // Delete a guild - * guild.delete() - * .then(guild => console.log(`Deleted the guild ${guild}`)) - * .catch(console.error); - */ - async delete() { - await this.client.rest.delete(Routes.guild(this.id)); - return this; - } - /** * Sets whether this guild's invites are disabled. * diff --git a/packages/discord.js/src/structures/GuildTemplate.js b/packages/discord.js/src/structures/GuildTemplate.js index 3dceea76f452..0ba174cd56c3 100644 --- a/packages/discord.js/src/structures/GuildTemplate.js +++ b/packages/discord.js/src/structures/GuildTemplate.js @@ -1,9 +1,6 @@ 'use strict'; -const { setTimeout, clearTimeout } = require('node:timers'); const { RouteBases, Routes } = require('discord-api-types/v10'); -const { resolveImage } = require('../util/DataResolver.js'); -const { Events } = require('../util/Events.js'); const { Base } = require('./Base.js'); /** @@ -127,46 +124,6 @@ class GuildTemplate extends Base { return this; } - /** - * Creates a guild based on this template. - * This is only available to bots in fewer than 10 guilds. - * - * @param {string} name The name of the guild - * @param {BufferResolvable|Base64Resolvable} [icon] The icon for the guild - * @returns {Promise} - */ - async createGuild(name, icon) { - const { client } = this; - const data = await client.rest.post(Routes.template(this.code), { - body: { - name, - icon: await resolveImage(icon), - }, - }); - - if (client.guilds.cache.has(data.id)) return client.guilds.cache.get(data.id); - - return new Promise(resolve => { - function resolveGuild(guild) { - client.off(Events.GuildCreate, handleGuild); - client.decrementMaxListeners(); - resolve(guild); - } - - client.incrementMaxListeners(); - client.on(Events.GuildCreate, handleGuild); - - const timeout = setTimeout(() => resolveGuild(client.guilds._add(data)), 10_000).unref(); - - function handleGuild(guild) { - if (guild.id === data.id) { - clearTimeout(timeout); - resolveGuild(guild); - } - } - }); - } - /** * Options used to edit a guild template. * diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 25814b7d67cc..6468b50d0a74 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -1438,7 +1438,6 @@ export class Guild extends AnonymousGuild { public widgetEnabled: boolean | null; public get maximumBitrate(): number; public createTemplate(name: string, description?: string): Promise; - public delete(): Promise; public discoverySplashURL(options?: ImageURLOptions): string | null; public edit(options: GuildEditOptions): Promise; public editOnboarding(options: GuildOnboardingEditOptions): Promise; @@ -1489,7 +1488,6 @@ export class Guild extends AnonymousGuild { public setVerificationLevel(verificationLevel: GuildVerificationLevel | null, reason?: string): Promise; public setPremiumProgressBarEnabled(enabled?: boolean, reason?: string): Promise; public setWidgetSettings(settings: GuildWidgetSettingsData, reason?: string): Promise; - public setMFALevel(level: GuildMFALevel, reason?: string): Promise; public toJSON(): unknown; } @@ -1824,7 +1822,6 @@ export class GuildTemplate extends Base { public guildId: Snowflake; public serializedGuild: APITemplateSerializedSourceGuild; public unSynced: boolean | null; - public createGuild(name: string, icon?: Base64Resolvable | BufferResolvable): Promise; public delete(): Promise; public edit(options?: GuildTemplateEditOptions): Promise; public sync(): Promise;