Skip to content

refactor!: Invite classes #10888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 17, 2025
Merged

refactor!: Invite classes #10888

merged 14 commits into from
Jul 17, 2025

Conversation

Jiralite
Copy link
Member

@Jiralite Jiralite commented May 7, 2025

Please describe the changes this PR makes and why it should be merged:
Depending on the invite type, an invite class will be created, similar to components. This has the added benefit of stronger typings: group direct message invites cannot be deleted, they do not have target_application, etc.

The separation of properties was done per the API specification:

FriendInvite (discord/discord-api-docs#3659) was not created as applications can no longer seem to fetch them (returns unknown invite).

No other properties were added as they were not in the documentation.

Also contains miscellaneous fixes:

  • This nullish coalescing operator here was redundant, as adding channels already has a cache check.
    this.channel =
    this.client.channels._add(data.channel, this.guild, { cache: false }) ??
    this.client.channels.resolve(this.channelId);
    refactor!: Invite classes #10888 (comment)
  • Deleting an invite was typed to return the invite, but didn't
  • Approximate member and presence counts were typed to always return a number, but this is not true
  • with_counts is now configurable when fetching an invite

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)

@Jiralite Jiralite added this to the discord.js 15.0.0 milestone May 7, 2025
@Jiralite Jiralite requested a review from a team as a code owner May 7, 2025 08:57
Copy link

vercel bot commented May 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
discord-js ⬜️ Ignored (Inspect) Visit Preview Jul 17, 2025 9:48am
discord-js-guide ⬜️ Ignored (Inspect) Visit Preview Jul 17, 2025 9:48am

@Jiralite Jiralite changed the title refactor(ClientFetchInviteOptions): configurable withCounts refactor!: Invite classes May 7, 2025
@github-project-automation github-project-automation bot moved this from Todo to Review in Progress in discord.js May 7, 2025
@discordjs discordjs deleted a comment from Qjuh May 7, 2025
@Jiralite Jiralite requested a review from Qjuh May 7, 2025 18:05
@Jiralite Jiralite requested a review from Qjuh May 8, 2025 11:35
@Jiralite Jiralite force-pushed the refactor/invite-fixes branch from 293ac8d to d9e6960 Compare July 2, 2025 23:55
@github-project-automation github-project-automation bot moved this from Review in Progress to Review Approved in discord.js Jul 16, 2025
@Jiralite Jiralite merged commit 43a995b into main Jul 17, 2025
27 checks passed
@Jiralite Jiralite deleted the refactor/invite-fixes branch July 17, 2025 12:34
@github-project-automation github-project-automation bot moved this from Review Approved to Done in discord.js Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants