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

beginPrune

  • beginPrune(options?: IPruneOptions): Promise<number>
  • Begins a prune operation with the given settings. It is highly recommend to verify the number of users being pruned is accurate using discord.Guild.previewPrune.

    By default, prune will not remove users with roles. You can optionally include specific roles in your prune by providing the includeRoles option. Any inactive user that has a subset of the provided role(s) will be counted in the prune and users with additional roles will not.

    If the computePruneCount option is set to true (default), the returned value will be the number of users pruned. In large guilds, it is recommended to set this to false as it may time out the operation on Discord's end.

    Note: This is a costly operation, and should not be run too frequently.

    Parameters

    Returns Promise<number>

  • beginPrune(options: IPruneOptions & object): Promise<void>
  • Parameters

    Returns Promise<void>

createBan

createChannel

createEmoji

  • createEmoji(options: ICreateEmojiOptions): Promise<Emoji>
  • Attempts to create a new emoji with the values provided. Returns the new emoji upon success.

    Note: Emojis may be a maximum size of 256kb.

    Parameters

    Returns Promise<Emoji>

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

getOwnVoiceState

  • getOwnVoiceState(): Promise<VoiceState | null>
  • A convenience method to get the bot's voice state for the guild.

    Returns null if the bot doesn't have a voice state set.

    Returns Promise<VoiceState | null>

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

getVoiceState

  • getVoiceState(userId: Snowflake): Promise<VoiceState | null>
  • Get a member's voice state. Resolves as null if the member is not connected to a voice channel.

    Parameters

    Returns Promise<VoiceState | null>

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>

iterVoiceStates

  • iterVoiceStates(options?: IIterVoiceStatesOptions): AsyncIterableIterator<VoiceState>
  • Returns an async iterator over users connected to voice channels in this guild.

    You may optionally filter the results by channel, if a channelId is provided with the options object.

    Parameters

    Returns AsyncIterableIterator<VoiceState>

previewPrune

  • previewPrune(options?: IPreviewPruneOptions): Promise<number>
  • Returns the number of users that would be removed/kicked from the guild in a prune operation.

    By default, prune will not remove users with roles. You can optionally include specific roles in your prune by providing the includeRoles option. Any inactive user that has a subset of the provided role(s) will be counted in the prune and users with additional roles will not.

    Note: This is a costly operation, and should not be run too frequently.

    Parameters

    Returns Promise<number>

setOwnVoiceState

  • setOwnVoiceState(options: ISetVoiceStateOptions): Promise<void>
  • Sets and overwrites the bot's voice state within the guild.

    Using the required channelId option, you may connect to a voice or disconnect from a voice channel. If you want to move channels, specify a new channel id.

    Disconnect the bot from it's voice session by setting channelId to null.

    This usually triggers a VOICE_SERVER_UPDATE and/or VOICE_STATE_UPDATE events. Information from these events can be used to externally orchestrate voice protocol sockets.

    Parameters

    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