From 2013afd3b0082283b7b2cbe4d0426b5da2054400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Conor=E2=84=A2?= Date: Fri, 29 Aug 2025 23:40:32 +0100 Subject: [PATCH 1/6] Remove withExpiration --- index.d.ts | 4 ++++ lib/Client.js | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index 6cd2a5d39..a444cb71e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -2353,8 +2353,12 @@ declare namespace Eris { getGuildWidget(guildID: string): Promise; getGuildWidgetImageURL(guildID: string, style?: GuildWidgetStyles): string; getGuildWidgetSettings(guildID: string): Promise; + /** @deprecated */ getInvite(inviteID: string, withCounts?: false, withExpiration?: boolean, guildScheduledEventID?: string): Promise>; + /** @deprecated */ getInvite(inviteID: string, withCounts: true, withExpiration?: boolean, guildScheduledEventID?: string): Promise>; + getInvite(inviteID: string, withCounts?: false, guildScheduledEventID?: string): Promise>; + getInvite(inviteID: string, withCounts: true, guildScheduledEventID?: string): Promise>; getJoinedPrivateArchivedThreads(channelID: string, options?: GetArchivedThreadsOptions): Promise>; getMessage(channelID: string, messageID: string): Promise; getMessageReaction(channelID: string, messageID: string, reaction: string, options?: GetMessageReactionOptions): Promise; diff --git a/lib/Client.js b/lib/Client.js index 97f9ea634..c3a3cb6d8 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -3019,14 +3019,13 @@ class Client extends EventEmitter { * Get info on an invite * @arg {String} inviteID The ID of the invite * @arg {Boolean} [withCounts] Whether to fetch additional invite info or not (approximate member counts, approximate presences, channel counts, etc.) - * @arg {Boolean} [withExpiration] Whether to fetch the expiration time or not + * @arg {Boolean} [withExpiration] [DEPRECATED] Whether to fetch the expiration time or not. This is deprecated because Discord will now always return the expiration date * @arg {String} [guildScheduledEventID] The guild scheduled event to include with the invite * @returns {Promise} */ - getInvite(inviteID, withCounts, withExpiration, guildScheduledEventID) { + getInvite(inviteID, withCounts, _withExpiration, guildScheduledEventID) { return this.requestHandler.request("GET", Endpoints.INVITE(inviteID), true, { with_counts: withCounts, - with_expiration: withExpiration, guild_scheduled_event_id: guildScheduledEventID, }).then((invite) => new Invite(invite, this)); } From 8ddbb7bb30a743895503da1e8e49c56eea08f645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Conor=E2=84=A2?= Date: Fri, 29 Aug 2025 23:40:50 +0100 Subject: [PATCH 2/6] backwards compatible & deprecation warning --- lib/Client.js | 5 +++++ lib/util/emitDeprecation.js | 1 + 2 files changed, 6 insertions(+) diff --git a/lib/Client.js b/lib/Client.js index c3a3cb6d8..d8698938d 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -3024,6 +3024,11 @@ class Client extends EventEmitter { * @returns {Promise} */ getInvite(inviteID, withCounts, _withExpiration, guildScheduledEventID) { + if (typeof _withExpiration === "string") { + guildScheduledEventID = _withExpiration; + } else if (typeof _withExpiration === "boolean") { + emitDeprecation("GET_INVITE_WITH_EXPIRATION"); + } return this.requestHandler.request("GET", Endpoints.INVITE(inviteID), true, { with_counts: withCounts, guild_scheduled_event_id: guildScheduledEventID, diff --git a/lib/util/emitDeprecation.js b/lib/util/emitDeprecation.js index 66e682511..c90f9538c 100644 --- a/lib/util/emitDeprecation.js +++ b/lib/util/emitDeprecation.js @@ -4,6 +4,7 @@ const warningMessages = { DEFAULT_PERMISSION: "Passing a defaultPermission for application commands is deprecated. Use defaultMemberPermissions instead.", DELETE_MESSAGE_DAYS: "Passing the deleteMessageDays parameter to banGuildMember is deprecated. Use an options object with deleteMessageSeconds instead.", DM_REACTION_REMOVE: "Passing a userID when using removeMessageReaction() in a DMChannel is deprecated. This behavior is no longer supported by Discord.", + GET_INVITE_WITH_EXPIRATION: "Passing withExpiration to getInvite() is deprecated. This is because Discord now always sends an expiration date when fetching an invite.", GET_REACTION_BEFORE: "Passing the before parameter to getMessageReaction() is deprecated. Discord no longer supports this parameter.", MEMBER_PERMISSION: "Member#permission is deprecated. Use Member#permissions instead.", MESSAGE_REFERENCE: "Passing the content.messageReferenceID option to createMessage() is deprecated. Use the content.messageReference option instead.", From eb9cac85a2f3df2f049664bb4ff3872f25cf72be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Conor=E2=84=A2?= Date: Sun, 31 Aug 2025 00:16:15 +0100 Subject: [PATCH 3/6] Invite flags --- index.d.ts | 1 + lib/Constants.d.ts | 4 ++++ lib/Constants.js | 5 +++++ lib/structures/Invite.js | 5 +++++ lib/structures/Member.js | 2 +- 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index a444cb71e..a6264ba51 100644 --- a/index.d.ts +++ b/index.d.ts @@ -3050,6 +3050,7 @@ declare namespace Eris { // @ts-ignore: Property is only not null when invite metadata is supplied createdAt: CT extends "withMetadata" ? number : null; expiresAt?: CT extends "withCount" ? number | null : null; + flags?: number; guild: CT extends "withMetadata" ? Guild // Invite with Metadata always has guild prop : CH extends Extract // Invite without Metadata diff --git a/lib/Constants.d.ts b/lib/Constants.d.ts index 402157741..91758d21f 100644 --- a/lib/Constants.d.ts +++ b/lib/Constants.d.ts @@ -235,6 +235,7 @@ export default interface Constants { "DEVELOPER_SUPPORT_SERVER", "DISCOVERABLE", "FEATURABLE", + "GUEST_INVITES", "INVITES_DISABLED", "INVITE_SPLASH", "MEMBER_VERIFICATION_GATE_ENABLED", @@ -357,6 +358,9 @@ export default interface Constants { APPLICATION_COMMAND_AUTOCOMPLETE: 4; MODAL_SUBMIT: 5; }; + InviteFlags: { + IS_GUEST_INVITE: 1; + }; InviteTargetTypes: { STREAM: 1; EMBEDDED_APPLICATION: 2; diff --git a/lib/Constants.js b/lib/Constants.js index c0de89331..84e0030ba 100644 --- a/lib/Constants.js +++ b/lib/Constants.js @@ -275,6 +275,7 @@ module.exports.GuildFeatures = [ "DEVELOPER_SUPPORT_SERVER", "DISCOVERABLE", "FEATURABLE", + "GUEST_INVITES", "INVITE_SPLASH", "INVITES_DISABLED", "MEMBER_VERIFICATION_GATE_ENABLED", @@ -436,6 +437,10 @@ module.exports.InteractionTypes = { MODAL_SUBMIT: 5, }; +module.exports.InviteFlags = { + IS_GUEST_INVITE: 1 << 0, +}; + module.exports.InviteTargetTypes = { STREAM: 1, EMBEDDED_APPLICATION: 2, diff --git a/lib/structures/Invite.js b/lib/structures/Invite.js index d9b82763f..ef49f4048 100644 --- a/lib/structures/Invite.js +++ b/lib/structures/Invite.js @@ -14,6 +14,7 @@ const Member = require("./Member"); * @prop {String} code The invite code * @prop {Number?} createdAt Timestamp of invite creation * @prop {Number?} expiresAt Timestamp of invite expiration + * @prop {Number?} flags The invite flags. For now, if there are any invite flags, they will only be `1` (meaning this invite is a guest invite for a voice channel) * @prop {(Guild | Object)?} guild Info on the invite guild. If the guild is not cached, this will be an object with an `id` key. No other property is guaranteed. * @prop {User?} inviter The invite creator * @prop {Number?} maxAge How long the invite lasts in seconds @@ -71,6 +72,9 @@ class Invite extends Base { } else { this.stageInstance = null; } + if (data.flags !== undefined) { + this.flags = data.flags; + } this.targetApplicationID = data.target_application !== undefined ? data.target_application.id : null; this.targetType = data.target_type !== undefined ? data.target_type : null; this.targetUser = data.target_user !== undefined ? this._client.users.update(data.target_user, this._client) : null; @@ -102,6 +106,7 @@ class Invite extends Base { "channel", "code", "createdAt", + "flags", "guild", "maxAge", "maxUses", diff --git a/lib/structures/Member.js b/lib/structures/Member.js index 9f87aaac7..a0957545b 100644 --- a/lib/structures/Member.js +++ b/lib/structures/Member.js @@ -34,7 +34,7 @@ const VoiceState = require("./VoiceState"); * @prop {String?} globalName The user's display name, if it is set. For bots, this is the application name * @prop {Guild} guild The guild the member is in * @prop {String} id The ID of the member - * @prop {Number?} joinedAt Timestamp of when the member joined the guild + * @prop {Number?} joinedAt Timestamp of when the member joined the guild (Note: Member objects retrieved from `Client#voiceStateUpdate` events will have `joinedAt` set as `null` if the member was invited as a guest) * @prop {String} mention A string that mentions the member * @prop {String?} nick The server nickname of the member * @prop {Boolean?} pending Whether the member has passed the guild's Membership Screening requirements From 2855ded1793725ae33e5942c725bac3a516cdae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Conor=E2=84=A2?= Date: Sun, 31 Aug 2025 17:42:18 +0100 Subject: [PATCH 4/6] Invite types --- lib/Constants.d.ts | 5 +++++ lib/Constants.js | 6 ++++++ lib/structures/Invite.js | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/lib/Constants.d.ts b/lib/Constants.d.ts index 91758d21f..93d1ce4bf 100644 --- a/lib/Constants.d.ts +++ b/lib/Constants.d.ts @@ -365,6 +365,11 @@ export default interface Constants { STREAM: 1; EMBEDDED_APPLICATION: 2; }; + InviteTypes: { + GUILD: 0; + GROUP_DM: 1; + FRIEND: 2; + }; Locales: { BULGARIAN: "bg"; CZECH: "cs"; diff --git a/lib/Constants.js b/lib/Constants.js index 84e0030ba..555f4393a 100644 --- a/lib/Constants.js +++ b/lib/Constants.js @@ -446,6 +446,12 @@ module.exports.InviteTargetTypes = { EMBEDDED_APPLICATION: 2, }; +module.exports.InviteTypes = { + GUILD: 0, + GROUP_DM: 1, + FRIEND: 2, +}; + module.exports.Locales = { BULGARIAN: "bg", CZECH: "cs", diff --git a/lib/structures/Invite.js b/lib/structures/Invite.js index ef49f4048..92da320b7 100644 --- a/lib/structures/Invite.js +++ b/lib/structures/Invite.js @@ -26,6 +26,7 @@ const Member = require("./Member"); * @prop {Number?} targetType The type of the target application * @prop {User?} targetUser The user whose stream is displayed for the invite (voice channel only) * @prop {Boolean?} temporary Whether the invite grants temporary membership or not + * @prop {Number} type The type of invite. See [the official Discord API documentation entry](https://discord.com/developers/docs/resources/invite#invite-object-invite-types) for valid types * @prop {Number?} uses The number of invite uses */ class Invite extends Base { @@ -75,6 +76,9 @@ class Invite extends Base { if (data.flags !== undefined) { this.flags = data.flags; } + if (data.type !== undefined) { + this.type = data.type; + } this.targetApplicationID = data.target_application !== undefined ? data.target_application.id : null; this.targetType = data.target_type !== undefined ? data.target_type : null; this.targetUser = data.target_user !== undefined ? this._client.users.update(data.target_user, this._client) : null; From a02952d7efe5039fa1741a4645b95406fc46c575 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Conor=E2=84=A2?= Date: Sun, 31 Aug 2025 18:02:58 +0100 Subject: [PATCH 5/6] oops --- index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.d.ts b/index.d.ts index a6264ba51..2d6b9c406 100644 --- a/index.d.ts +++ b/index.d.ts @@ -150,6 +150,7 @@ declare namespace Eris { // Invite type InviteTargetTypes = Constants["InviteTargetTypes"][keyof Constants["InviteTargetTypes"]]; + type InviteTypes = Constants["InviteTypes"][keyof Constants["InviteTypes"]]; // Message type ActionRowComponents = Button | SelectMenu; @@ -3067,6 +3068,7 @@ declare namespace Eris { /** @deprecated */ stageInstance: CH extends StageChannel ? InviteStageInstance : null; temporary: CT extends "withMetadata" ? boolean : null; + type: InviteTypes; uses: CT extends "withMetadata" ? number : null; constructor(data: BaseData, client: Client); delete(reason?: string): Promise; From bbe22a5fd3c39e2cc9b982ddbffb4ab44b280124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Conor=E2=84=A2?= Date: Mon, 6 Oct 2025 17:16:45 +0100 Subject: [PATCH 6/6] fix feature name --- lib/Constants.d.ts | 2 +- lib/Constants.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Constants.d.ts b/lib/Constants.d.ts index 93d1ce4bf..75dcf237e 100644 --- a/lib/Constants.d.ts +++ b/lib/Constants.d.ts @@ -235,7 +235,7 @@ export default interface Constants { "DEVELOPER_SUPPORT_SERVER", "DISCOVERABLE", "FEATURABLE", - "GUEST_INVITES", + "GUESTS_ENABLED", "INVITES_DISABLED", "INVITE_SPLASH", "MEMBER_VERIFICATION_GATE_ENABLED", diff --git a/lib/Constants.js b/lib/Constants.js index 555f4393a..fa55bb860 100644 --- a/lib/Constants.js +++ b/lib/Constants.js @@ -275,7 +275,7 @@ module.exports.GuildFeatures = [ "DEVELOPER_SUPPORT_SERVER", "DISCOVERABLE", "FEATURABLE", - "GUEST_INVITES", + "GUESTS_ENABLED", "INVITE_SPLASH", "INVITES_DISABLED", "MEMBER_VERIFICATION_GATE_ENABLED",