Class Guild

Represents a Discord server.

Hierarchy

Constructors

Properties

Accessors

Methods

Constructors

  • Parameters

    Returns Guild

Properties

_clientMember?: any
_rest: any
_shard?: any
afkChannel?: null | VoiceChannel

This guild's afk voice channel.

afkChannelID: null | string

The ID of this guild's afk voice channel.

afkTimeout: number

The seconds after which voice users will be moved to the afk channel.

application?: null | ClientApplication

The application that created this guild, if applicable.

applicationID: null | string

The ID of the application that created this guild, if applicable.

approximateMemberCount?: number

The approximate number of members in this guild (if retrieved with counts).

approximatePresenceCount?: number

The approximate number of non-offline members in this guild (if retrieved with counts).

auditLogEntries: TypedCollection<string, RawAuditLogEntry, AuditLogEntry, []>

The cached audit log entries. This requires both the GUILD_MODERATION intent, as well as the VIEW_AUDIT_LOG permission.

autoModerationRules: TypedCollection<string, RawAutoModerationRule, AutoModerationRule, []>

The auto moderation rules in this guild.

banner: null | string

The hash of this guild's banner.

The channels in this guild.

defaultMessageNotifications: DefaultMessageNotificationLevels

The default message notifications level of this guild.

description: null | string

The description of this guild.

discoverySplash: null | string

The discovery splash of this guild. Only present if the guild has the DISCOVERABLE feature.

emojis: GuildEmoji[]

The custom emojis of this guild.

explicitContentFilter: ExplicitContentFilterLevels

The explicit content filter of this guild.

features: ("ANIMATED_BANNER" | "ANIMATED_ICON" | "APPLICATION_COMMAND_PERMISSIONS_V2" | "AUTO_MODERATION" | "BANNER" | "BOT_DEVELOPER_EARLY_ACCESS" | "CLYDE_ENABLED" | "COMMUNITY_EXP_LARGE_GATED" | "COMMUNITY_EXP_LARGE_UNGATED" | "COMMUNITY_EXP_MEDIUM" | "COMMUNITY" | "CREATOR_MONETIZABLE_DISABLED" | "CREATOR_MONETIZABLE_PROVISIONAL" | "CREATOR_MONETIZABLE" | "CREATOR_STORE_PAGE" | "DEVELOPER_SUPPORT_SERVER" | "DISCOVERABLE_DISABLED" | "DISCOVERABLE" | "ENABLED_DISCOVERABLE_BEFORE" | "EXPOSED_TO_ACTIVITIES_WTP_EXPERIMENT" | "FEATURABLE" | "GUESTS_ENABLED" | "GUILD_HOME_TEST" | "GUILD_ONBOARDING_EVER_ENABLED" | "GUILD_ONBOARDING_HAS_PROMPTS" | "GUILD_ONBOARDING" | "GUILD_WEB_PAGE_VANITY_URL" | "HAD_EARLY_ACTIVITIES_ACCESS" | "HAS_DIRECTORY_ENTRY" | "HUB" | "INCREASED_THREAD_LIMIT" | "INTERNAL_EMPLOYEE_ONLY" | "INVITE_SPLASH" | "INVITES_DISABLED" | "LINKED_TO_HUB" | "MARKETPLACES_CONNECTION_ROLES" | "MEMBER_PROFILES" | "MEMBER_VERIFICATION_GATE_ENABLED" | "MONETIZATION_ENABLED" | "MORE_EMOJI" | "MORE_EMOJIS" | "MORE_STICKERS" | "NEW_THREAD_PERMISSIONS" | "NEWS" | "PARTNERED" | "PREVIEW_ENABLED" | "PREVIOUSLY_DISCOVERABLE" | "PRIVATE_THREADS" | "RAID_ALERTS_ENABLED" | "ROLE_ICONS" | "ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE" | "ROLE_SUBSCRIPTIONS_ENABLED" | "SEVEN_DAY_THREAD_ARCHIVE" | "SOUNDBOARD" | "TEXT_IN_VOICE_ENABLED" | "THREADS_ENABLED_TESTING" | "THREADS_ENABLED" | "THREE_DAY_THREAD_ARCHIVE" | "TICKETED_EVENTS_ENABLED" | "VANITY_URL" | "VERIFIED" | "VIP_REGIONS" | "WELCOME_SCREEN_ENABLED")[]

The features this guild has.

icon: null | string

The icon hash of this guild.

id: string
integrations: TypedCollection<string, RawIntegration, Integration, [guildID?: string]>

The integrations in this guild.

invites: Collection<string, Invite<"withMetadata", Uncached | AnyInviteChannel>>

The cached invites in this guild. This will only be populated by invites created while the client is active.

joinedAt: null | Date

The date at which this guild was joined.

large: boolean

If this guild is considered large.

latestOnboardingQuestionID: null | string
maxMembers?: number

The maximum amount of members this guild can have.

maxPresences?: number

The maximum amount of people that can be present at a time in this guild. Only present for very large guilds.

maxStageVideoChannelUsers?: number

The maximum amount of users that can be present in a stage video channel.

maxVideoChannelUsers?: number

The maximum amount of users that can be present in a video channel.

memberCount: number

The number of members in this guild.

members: TypedCollection<string, RawMember | RESTMember, Member, [guildID: string]>

The cached members in this guild.

mfaLevel: MFALevels

The required mfa level for moderators of this guild.

name: string

The name of this guild.

nsfwLevel: GuildNSFWLevels

The nsfw level of this guild.

owner?: null | User

The owner of this guild.

ownerID: null | string

The ID of the owner of this guild.

preferredLocale: string

The preferred locale of this guild.

premiumProgressBarEnabled: boolean

If this guild has the boost progress bar enabled.

premiumSubscriptionCount?: number

The number of nitro boosts this guild has.

premiumTier: PremiumTiers

The boost level of this guild.

publicUpdatesChannel?: null | AnyTextableGuildChannel

The channel where notices from Discord are received. Only present in guilds with the COMMUNITY feature.

publicUpdatesChannelID: null | string

The id of the channel where notices from Discord are received. Only present in guilds with the COMMUNITY feature.

region?: null | string

Deprecated

The region of this guild.

roles: TypedCollection<string, RawRole, Role, [guildID: string]>

The roles in this guild.

rulesChannel?: null | TextChannel

The channel where rules/guidelines are displayed. Only present in guilds with the COMMUNITY feature.

rulesChannelID: null | string

The id of the channel where rules/guidelines are displayed. Only present in guilds with the COMMUNITY feature.

safetyAlertsChannel?: null | TextChannel

The channel where safety related notices are posted.

safetyAlertsChannelID: null | string

The ID if the channel where safety related notices are posted.

The scheduled events in this guild.

splash: null | string

The invite splash hash of this guild.

stageInstances: TypedCollection<string, RawStageInstance, StageInstance, []>

The stage instances in this guild.

stickers: Sticker[]

The custom stickers of this guild.

systemChannel?: null | TextChannel

The channel where welcome messages and boosts notices are posted.

systemChannelFlags: number

The flags for the system channel.

systemChannelID: null | string

The ID of the channel where welcome messages and boosts notices are posted.

The threads in this guild.

toggleFeature: any
unavailable: boolean

If this guild is unavailable.

updateMemberLimit: any
vanityURLCode: null | string

The vanity url of this guild. Only present in guilds with the VANITY_URL feature.

verificationLevel: VerificationLevels

The verification level of this guild.

The voice states of members in voice channels.

welcomeScreen?: WelcomeScreen

The welcome screen configuration. Only present in guilds with the WELCOME_SCREEN_ENABLED feature.

The channel the widget will generate an invite to, or null if set to no invite.

widgetChannelID: null | string

The id of the channel the widget will generate an invite to, or null if set to no invite.

widgetEnabled?: boolean

If the widget is enabled.

Accessors

  • get clientMember(): Member
  • The client's member for this guild. This will throw an error if the member is not cached.

    Returns Member

  • get createdAt(): Date
  • Returns Date

  • get shard(): Shard
  • The shard this guild is on. Gateway only.

    Returns Shard

  • get voiceAdapterCreator(): DiscordGatewayAdapterCreator
  • The voice adapter creator for this guild that can be used with @discordjs/voice to play audio in voice and stage channels.

    Returns DiscordGatewayAdapterCreator

Methods

  • Add a member to this guild. Requires an access token with the guilds.join scope.

    Returns the newly added member upon success, or void if the member is already in the guild.

    Parameters

    • userID: string

      The ID of the user to add.

    • options: AddMemberOptions

      The options for adding the member.

    Returns Promise<void | Member>

  • Add a role to a member.

    Parameters

    • memberID: string

      The ID of the member.

    • roleID: string

      The ID of the role to add.

    • Optional reason: string

      The reason for adding the role.

    Returns Promise<void>

  • The url of this guild's banner.

    Parameters

    • Optional format: "jpg" | "jpeg" | "png" | "webp" | "gif"

      The format the url should be.

    • Optional size: number

      The dimensions of the image.

    Returns null | string

  • Begin a prune.

    Parameters

    Returns Promise<null | number>

  • Create a ban for a user.

    Parameters

    • userID: string

      The ID of the user.

    • Optional options: CreateBanOptions

      The options for creating the ban.

    Returns Promise<void>

  • Create an emoji in this guild.

    Parameters

    Returns Promise<GuildEmoji>

  • Create a role.

    Parameters

    Returns Promise<Role>

  • Create a scheduled event in this guild.

    Parameters

    Returns Promise<GuildScheduledEvent>

  • Create a sticker.

    Parameters

    Returns Promise<Sticker>

  • Create a guild template.

    Parameters

    • options: CreateTemplateOptions

      The options for creating the template.

    Returns Promise<GuildTemplate>

  • Delete this guild.

    Returns Promise<void>

  • Delete an auto moderation rule in this guild.

    Parameters

    • ruleID: string

      The ID of the rule to delete.

    • Optional reason: string

      The reason for deleting the rule.

    Returns Promise<void>

  • Delete an emoji in this guild.

    Parameters

    • emojiID: string

      The ID of the emoji.

    • Optional reason: string

      The reason for deleting the emoji.

    Returns Promise<void>

  • Delete an integration.

    Parameters

    • integrationID: string

      The ID of the integration.

    • Optional reason: string

      The reason for deleting the integration.

    Returns Promise<void>

  • Delete a role.

    Parameters

    • roleID: string

      The ID of the role to delete.

    • Optional reason: string

      The reason for deleting the role.

    Returns Promise<void>

  • Delete a scheduled event.

    Parameters

    • eventID: string

      The ID of the scheduled event.

    • Optional reason: string

      The reason for deleting the scheduled event. Discord's docs do not explicitly state a reason can be provided, so it may not be used.

    Returns Promise<void>

  • Delete a sticker.

    Parameters

    • stickerID: string

      The ID of the sticker to delete.

    • Optional reason: string

      The reason for deleting the sticker.

    Returns Promise<void>

  • Delete a template.

    Parameters

    • code: string

      The code of the template.

    Returns Promise<void>

  • Disable the COMMUNITY feature for this guild. Requires the Administrator permission.

    Parameters

    • Optional reason: string

      The reason for disable the feature.

    Returns Promise<Guild>

  • Disable the DISCOVERABLE feature for this guild. Requires the Administrator permission.

    Parameters

    • Optional reason: string

      The reason for disabling the feature.

    Returns Promise<Guild>

  • Disable the INVITES_DISABLED feature for this guild. Requires the Manage Guild permission.

    Parameters

    • Optional reason: string

      The reason for disabling the feature.

    Returns Promise<Guild>

  • Disable the RAID_ALERTS_ENABLED feature for this guild. Requires the Manage Guild permission.

    Parameters

    • Optional reason: string

      The reason for disabling the feature.

    Returns Promise<Guild>

  • The url of this guild's discovery splash.

    Parameters

    • Optional format: "jpg" | "jpeg" | "png" | "webp" | "gif"

      The format the url should be.

    • Optional size: number

      The dimensions of the image.

    Returns null | string

  • Edit this guild.

    Parameters

    Returns Promise<Guild>

  • Edit an existing auto moderation rule in this guild.

    Parameters

    • ruleID: string

      The ID of the rule to edit.

    • options: Partial<Pick<CreateAutoModerationRuleOptions, "name" | "eventType" | "triggerMetadata" | "actions" | "enabled" | "exemptRoles" | "exemptChannels" | "reason">>

      The options for editing the rule.

    Returns Promise<AutoModerationRule>

  • Edit the positions of channels in this guild.

    Parameters

    Returns Promise<void>

  • Modify the current member in this guild.

    Parameters

    Returns Promise<Member>

  • Edit the current member's voice state in this guild. channelID is required, and the current member must already be in that channel. See Discord's docs for more information.

    Parameters

    Returns Promise<void>

  • Edit an existing emoji in this guild.

    Parameters

    Returns Promise<GuildEmoji>

  • Edit the mfa level of this guild. This can only be used by the guild owner.

    Parameters

    Returns Promise<MFALevels>

  • Edit a member of this guild. Use <Guild>.editCurrentMember if you wish to update the nick of this client using the CHANGE_NICKNAME permission.

    Parameters

    • memberID: string

      The ID of the member.

    • options: EditMemberOptions

      The options for editing the member.

    Returns Promise<Member>

  • Edit this guild's onboarding configuration.

    Parameters

    Returns Promise<Onboarding>

  • Edit an existing role.

    Parameters

    • roleID: string
    • options: EditRoleOptions

      The options for editing the role.

    Returns Promise<Role>

  • Edit the position of roles in this guild.

    Parameters

    Returns Promise<Role[]>

  • Edit an existing scheduled event in this guild.

    Parameters

    Returns Promise<GuildScheduledEvent>

  • Edit a sticker.

    Parameters

    Returns Promise<Sticker>

  • Edit a template.

    Parameters

    • code: string

      The code of the template.

    • options: EditGuildTemplateOptions

      The options for editing the template.

    Returns Promise<GuildTemplate>

  • Edit a guild member's voice state. channelID is required, and the user must already be in that channel. See Discord's docs for more information.

    Parameters

    Returns Promise<void>

  • Edit the welcome screen in this guild.

    Parameters

    Returns Promise<WelcomeScreen>

  • Edit the widget of this guild.

    Parameters

    Returns Promise<Widget>

  • Enable the COMMUNITY feature for this guild. Requires the Administrator permission.

    Parameters

    • Optional reason: string

      The reason for enabling the feature.

    Returns Promise<Guild>

  • Enable the DISCOVERABLE feature for this guild. Requires the Administrator permission. The server must also be passing all discovery requirements.

    Parameters

    • Optional reason: string

      The reason for enabling the feature.

    Returns Promise<Guild>

  • Enable the INVITES_DISABLED feature for this guild. Requires the Manage Guild permission.

    Parameters

    • Optional reason: string

      The reason for enabling the feature.

    Returns Promise<Guild>

  • Enable the RAID_ALERTS_ENABLED feature for this guild. Requires the Manage Guild permission.

    Parameters

    • Optional reason: string

      The reason for enabling the feature.

    Returns Promise<Guild>

  • Request members from this guild.

    Parameters

    Returns Promise<Member[]>

  • Get the active threads in this guild.

    Returns Promise<GetActiveThreadsResponse>

  • Get this guild's audit log.

    Parameters

    Returns Promise<AuditLog>

  • Get an auto moderation rule for this guild.

    Parameters

    • ruleID: string

      The ID of the rule to get.

    Returns Promise<AutoModerationRule>

  • Get the auto moderation rules for this guild.

    Returns Promise<AutoModerationRule[]>

  • Get a ban in this guild.

    Parameters

    • userID: string

      The ID of the user to get the ban of.

    Returns Promise<Ban>

  • Get the bans in this guild.

    Parameters

    Returns Promise<Ban[]>

  • Get the channels in a guild. Does not include threads. Only use this if you need to. See the channels collection.

    Returns Promise<AnyGuildChannelWithoutThreads[]>

  • Get an emoji in this guild.

    Parameters

    • emojiID: string

      The ID of the emoji to get.

    Returns Promise<GuildEmoji>

  • Get the emojis in this guild.

    Returns Promise<GuildEmoji[]>

  • Get the integrations in this guild.

    Returns Promise<Integration[]>

  • Get the invites of this guild.

    Returns Promise<Invite<"withMetadata", AnyInviteChannel>[]>

  • Get a member of this guild.

    Parameters

    • memberID: string

      The ID of the member.

    Returns Promise<Member>

  • Get this guild's members. This requires the GUILD_MEMBERS intent.

    Parameters

    Returns Promise<Member[]>

  • Get the onboarding information for this guild.

    Returns Promise<Onboarding>

  • Get a preview of this guild.

    Returns Promise<GuildPreview>

  • Get the prune count of this guild.

    Parameters

    Returns Promise<number>

  • Get the roles in this guild. Only use this if you need to. See the roles collection.

    Returns Promise<Role[]>

  • Get a scheduled event.

    Parameters

    • eventID: string

      The ID of the scheduled event to get.

    • Optional withUserCount: number

      If the number of users subscribed to the event should be included.

    Returns Promise<GuildScheduledEvent>

  • Get the users subscribed to a scheduled event.

    Parameters

    • eventID: string

      The ID of the scheduled event to get the users of.

    • Optional options: GetScheduledEventUsersOptions

      The options for getting the users.

    Returns Promise<ScheduledEventUser[]>

  • Get this guild's scheduled events

    Parameters

    • Optional withUserCount: number

      If the number of users subscribed to the event should be included.

    Returns Promise<GuildScheduledEvent[]>

  • Get a sticker. Response will include a user if the client has the MANAGE_EMOJIS_AND_STICKERS permissions.

    Parameters

    • stickerID: string

      The ID of the sticker to get.

    Returns Promise<Sticker>

  • Get this guild's stickers. Stickers will include a user if the client has the MANAGE_EMOJIS_AND_STICKERS permissions.

    Returns Promise<Sticker[]>

  • Get this guild's templates.

    Returns Promise<GuildTemplate[]>

  • Get the vanity url of this guild.

    Returns Promise<GetVanityURLResponse>

  • Get the list of usable voice regions for this guild. This will return VIP servers when the guild is VIP-enabled.

    Returns Promise<VoiceRegion[]>

  • Get the webhooks in this guild.

    Returns Promise<Webhook[]>

  • Get the welcome screen for this guild.

    Returns Promise<WelcomeScreen>

  • Get the widget of this guild.

    Returns Promise<Widget>

  • Get the widget image of this guild.

    Parameters

    Returns Promise<Buffer>

  • Get the raw JSON widget of this guild.

    Returns Promise<RawWidget>

  • Get this guild's widget settings.

    Returns Promise<WidgetSettings>

  • The url of this guild's icon.

    Parameters

    • Optional format: "jpg" | "jpeg" | "png" | "webp" | "gif"

      The format the url should be.

    • Optional size: number

      The dimensions of the image.

    Returns null | string

  • Join a voice or stage channel.

    Parameters

    Returns VoiceConnection

  • Leave this guild.

    Returns Promise<void>

  • Leave the connected voice or stage channel on this guild.

    Returns void

  • Get the permissions of a member. If providing an id, the member must be cached.

    Parameters

    • member: string | Member

      The member to get the permissions of.

    Returns Permission

  • Remove a ban.

    Parameters

    • userID: string

      The ID of the user to remove the ban from.

    • Optional reason: string

      The reason for removing the ban.

    Returns Promise<void>

  • Remove a member from this guild.

    Parameters

    • memberID: string

      The ID of the user to remove.

    • Optional reason: string

      The reason for the removal.

    Returns Promise<void>

  • Remove a role from a member.

    Parameters

    • memberID: string

      The ID of the member.

    • roleID: string

      The ID of the role to remove.

    • Optional reason: string

      The reason for removing the role.

    Returns Promise<void>

  • Search the username & nicknames of members in this guild.

    Parameters

    Returns Promise<Member[]>

  • The url of this guild's invite splash.

    Parameters

    • Optional format: "jpg" | "jpeg" | "png" | "webp" | "gif"

      The format the url should be.

    • Optional size: number

      The dimensions of the image.

    Returns null | string

  • Sync a guild template.

    Parameters

    • code: string

      The code of the template to sync.

    Returns Promise<GuildTemplate>

  • Returns JSONGuild

  • Returns string

  • Parameters

    Returns void

  • Parameters

    • Optional timestamp: number | Date

    Returns string

  • Parameters

    • id: string

    Returns Date

  • Parameters

    • id: string

    Returns number

Generated using TypeDoc