Results

Namespace

Type

A Guild (aka Discord Server) contains basic guild identifiers, basic guild settings, and accessors to objects related to this guild.

A guild can be found by id with discord.getGuild, but you can usually access it from most objects related to a guild.

For example, discord.Message.getGuild, discord.GuildChannel.getGuild, and discord.GuildMember.getGuild are ways you can access a guild from related objects.

Hierarchy

  • Guild <-- You are here!

Index

Type aliases

Static CreateChannelOptions

Options you can pass to discord.Guild.createChannel.

Static IterAuditLogsOptionsWithActionType

IterAuditLogsOptionsWithActionType<T>: IIterAuditLogsOptions & object

Type parameters

Properties

Readonly afkChannelId

afkChannelId: Snowflake | null

The discord.GuildVoiceChannel's that determines what channel to send idle guild members to after the specified discord.Guild.afkTimeout.

Readonly afkTimeout

afkTimeout: number

After a guild member in a voice channel is idle for this amount of time (in seconds), they will be moved to the discord.GuildVoiceChannel determined in discord.Guild.afkChannelId (if set).

Readonly applicationId

applicationId: Snowflake | null

The application id tied to this guild. Typically set on Discord guilds with commerce features enabled.

Readonly banner

banner: string | null

If not null, holds a hash of the guild banner image.

The banner typically image appears above the guild channel list.

Use discord.Guild.getBannerUrl to build a full URL for the guild banner image.

Note: Requires the discord.Guild.Feature.BANNER flag in discord.Guild.features to be set.

Readonly defaultMessageNotifications

defaultMessageNotifications: NotificationsLevel

The default level of notifications new guild members will receive.

Guild members can override this setting individually.

Readonly description

description: string | null

If set, a user-submitted description of the guild. Requires the discord.Guild.Feature.PUBLIC feature flag.

Readonly explicitContentFilter

explicitContentFilter: ExplicitContentFilterLevel

The level of explicit image filtering that will occur on this guild.

Readonly features

features: Array<Feature>

A list of discord.Guild.Features available to this guild.

Readonly icon

icon: string | null

If not null, holds a hash of the guild icon image.

Use discord.Guild.getIconUrl to build a full URL for the guild icon.

Readonly id

The guild's unique Discord id. This field never changes.

Readonly maxPresences

maxPresences: number

The maximum amount of concurrent online users before this guild goes unavailable.

Generally increases as discord.Guild.memberCount increases.

Readonly memberCount

memberCount: number

The number of guild members who joined the guild.

Readonly mfaLevel

mfaLevel: number

The MFA level required to perform actions guarded by elevated discord.Permissions.

Readonly name

name: string

The name of the guild.

Readonly ownerId

ownerId: Snowflake

The user id that owns this guild.

Optional Readonly permissions

permissions: undefined | number

The permissions the bot has on the guild.

Readonly preferredLocale

preferredLocale: string

The preferred locale of the guild.

Readonly premiumSubscriptionCount

premiumSubscriptionCount: number

The number of boosts this server has.

Readonly premiumTier

premiumTier: PremiumTier | null

The current tier this guild has. Dependent on the amount of discord.Guild.premiumSubscriptionCount.

Readonly region

region: Region

The voice region this server is set to use.

Readonly splash

splash: string | null

If not null, holds a hash of the guild splash image hash.

The splash image appears as the background of guild invite pages for this guild.

Use discord.Guild.getSplashUrl to build a full URL for the guild splash image.

Note: Requires the discord.Guild.Feature.INVITE_SPLASH flag in discord.Guild.features to be set.

Readonly systemChannelId

systemChannelId: Snowflake | null

If not null, determines the channel in which receives guild member join and server boot announcements.

Readonly vanityUrlCode

vanityUrlCode: string | null

If set, the vanity invite code set on this guild. Requires the discord.Guild.Feature.VANITY_URL feature flag.

Readonly verificationLevel

verificationLevel: VerificationLevel

The level of verification this guild requires to send messages.

Readonly widgetChannelId

widgetChannelId: Snowflake | null

If discord.Guild.widgetEnabled is true, defines the channel users invited by the widget will see on join.

Readonly widgetEnabled

widgetEnabled: boolean

true if the guild widget is enabled.

Methods

createBan

createChannel

createRole

  • createRole(options: IRoleOptions): Promise<Role>
  • Creates a role on the guild.

    If an error occurs, a discord.ApiError is thrown.

    Parameters

    • options: IRoleOptions

      Settings for the new guild role. All fields are optional.

    Returns Promise<Role>

deleteBan

  • deleteBan(user: Snowflake | User | GuildMember): Promise<void>
  • Un-bans or otherwise removes a ban for a specific user from the guild.

    Parameters

    Returns Promise<void>

edit

editRolePositions

  • editRolePositions(rolePositions: Array<IRolePositionOptions>): Promise<Role[]>
  • Modifies the role positioning for the set of roles sent in the options param.

    Role positions are important for role hoisting and permission inheritance.

    On success, the Promise resolves an array of all guild role objects.

    Parameters

    Returns Promise<Role[]>

getAuditLogs

getBan

getBannerUrl

getBans

getChannel

  • getChannel(channelId: Snowflake): Promise<AnyGuildChannel | null>
  • Fetches a single channel from the guild, by id.

    Parameters

    • channelId: Snowflake

      The channel id of the channel you want to fetch

    Returns Promise<AnyGuildChannel | null>

    An instance of the channel if available, otherwise null.

getChannels

getEmoji

  • getEmoji(emojiId: Snowflake): Promise<Emoji | null>
  • Fetches a single emoji from the guild, by id.

    Parameters

    • emojiId: Snowflake

      The id of the emoji you wish to fetch.

    Returns Promise<Emoji | null>

getEmojis

  • getEmojis(): Promise<Emoji[]>
  • Fetches an array containing the emojis uploaded to this guild.

    Returns Promise<Emoji[]>

getIconUrl

getInvites

getMember

  • getMember(userId: Snowflake): Promise<GuildMember | null>
  • Fetches a single member from the guild, by user id.

    If the user is not a member of the guild, or the user is not found, the Promise will resolve as null.

    Parameters

    • userId: Snowflake

      The id of the member you wish to fetch.

    Returns Promise<GuildMember | null>

getMembers

getRole

  • getRole(roleId: Snowflake): Promise<Role | null>
  • Fetches a single role from the guild, by id.

    Parameters

    • roleId: Snowflake

      The id of the role you wish to fetch.

    Returns Promise<Role | null>

getRoles

  • getRoles(): Promise<Role[]>
  • Fetches an array of all the roles on this guild.

    Returns Promise<Role[]>

getSplashUrl

iterAuditLogs

iterMembers

  • iterMembers(options?: IIterMembersOptions): AsyncIterableIterator<GuildMember>
  • Returns an async iterable for the list of members on this guild.

    The runtime will stream members in chunks and yield individual discord.GuildMember instances as they become available. Iteration happens on an ascending basis, sorted by user id.

    Keep in mind this can be a particularly expensive operation to call depending on the amount of guild members are in the guild.

    ES2015 introduced the for..await..of statement, allowing you to loop asynchronously over the async generators and functions.

    Example: Removing a role from every member in a guild.

    for await (const member of guild.iterMembers()) {
      await member.removeRole(SOME_ROLE_ID);
    }

    Parameters

    Returns AsyncIterableIterator<GuildMember>

voiceDisconnect

  • voiceDisconnect(): Promise<void>
  • Disconnects any active voice sessions for the current bot user on this guild.

    Returns Promise<void>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc