fetchInvite

async fetchInvite(
code: string,
options: { guildScheduledEventId?: string; withCounts?: boolean; withExpiration?: boolean; }
) Promise<Invite | null>

Fetches an invite by its code. Pass only the code portion of an invite URL. For https://discord.gg/hTKzmak, the code is "hTKzmak". Returns null when the invite is invalid or expired.

Parameters:
  • code — – The part after discord.gg/.

  • options — – Options controlling which approximate counts and expiration fields Discord includes.