Class REST/Guilds

Various methods for interacting with guilds. Located at Client#rest.guilds.

Hierarchy

  • REST/Guilds

Constructors

Methods

  • Add a member to a 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

    • guildID: string

      The ID of the guild.

    • userID: string

      The ID of the user to add.

    • options: AddMemberOptions

      The options for adding the member.

    Returns Promise<undefined | Member>

    Caching

    This method may cache its result. The result will not be cached if the guild is not cached.

    Caches

    Guild#members

  • Add a role to a member.

    Parameters

    • guildID: string

      The ID of the guild.

    • 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>

    Caching

    This method does not cache its result.

  • Begin a prune.

    Parameters

    • guildID: string

      The ID of the guild.

    • Optional options: BeginPruneOptions

      The options for the prune.

    Returns Promise<null | number>

    Caching

    This method does not cache its result.

  • Create a ban for a user.

    Parameters

    • guildID: string

      The ID of the guild.

    • userID: string

      The ID of the user to ban.

    • Optional options: CreateBanOptions

      The options for creating the ban.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Create a guild from a template. This can only be used by bots in less than 10 guilds.

    Note: This does NOT add the guild to the client's cache.

    Parameters

    Returns Promise<Guild>

    Caching

    This method does not cache its result.

  • Delete a guild.

    Parameters

    • guildID: string

      The ID of the guild.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Delete an auto moderation rule.

    Parameters

    • guildID: string

      The ID of the guild.

    • ruleID: string

      The ID of the rule to delete.

    • Optional reason: string

      The reason for deleting the rule.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Delete an emoji.

    Parameters

    • guildID: string

      The ID of the guild.

    • emojiID: string

      The ID of the emoji.

    • Optional reason: string

      The reason for deleting the emoji.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Delete an integration.

    Parameters

    • guildID: string

      The ID of the guild.

    • integrationID: string

      The ID of the integration.

    • Optional reason: string

      The reason for deleting the integration.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Delete a role.

    Parameters

    • guildID: string

      The ID of the guild.

    • roleID: string

      The ID of the role to delete.

    • Optional reason: string

      The reason for deleting the role.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Delete a scheduled event.

    Parameters

    • guildID: string

      The ID of the guild.

    • 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>

    Caching

    This method does not cache its result.

  • Delete a sticker.

    Parameters

    • guildID: string

      The ID of the guild.

    • stickerID: string

      The ID of the sticker to delete.

    • Optional reason: string

      The reason for deleting the sticker.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Delete a template.

    Parameters

    • guildID: string

      The ID of the guild.

    • code: string

      The code of the template.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Edit the positions of channels in a guild.

    Parameters

    • guildID: string

      The ID of the guild.

    • options: ModifyChannelPositionsEntry[]

      The channels to move. Unedited channels do not need to be specified.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Edit the current member's voice state in a 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>

    Caching

    This method does not cache its result.

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

    Parameters

    • guildID: string

      The ID of the guild.

    • memberID: string

      The ID of the member.

    • options: EditMemberOptions

      The options for editing the member.

    Returns Promise<Member>

    Caching

    This method may cache its result. The result will not be cached if the guild is not cached.

    Caches

    Guild#members

  • Edit an existing role.

    Parameters

    • guildID: string

      The ID of the guild.

    • roleID: string
    • options: EditRoleOptions

      The options for editing the role.

    Returns Promise<Role>

    Caching

    This method may cache its result. The result will not be cached if the guild is not cached.

    Caches

    Guild#roles

  • Edit the position of roles in a guild.

    Parameters

    • guildID: string

      The ID of the guild.

    • options: EditRolePositionsEntry[]

      The roles to move.

    • Optional reason: string

    Returns Promise<Role[]>

    Caching

    This method may cache its result. The result will not be cached if the guild is not cached.

    Caches

    Guild#roles

  • 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

    • guildID: string

      The ID of the guild.

    • memberID: string

      The ID of the member.

    • options: EditUserVoiceStateOptions

      The options for editing the voice state.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Get a guild.

    Parameters

    • guildID: string

      The ID of the guild.

    • Optional withCounts: boolean

      If the approximate number of members and online members should be included.

    Returns Promise<Guild>

    Caching

    This method may cache its result. The result will not be cached if the guild is not already cached.

    Caches

    Client#guilds

  • Get a guild member.

    Parameters

    • guildID: string

      The ID of the guild.

    • memberID: string

      The ID of the member.

    Returns Promise<Member>

    Caching

    This method may cache its result. The result will not be cached if the guild is not cached.

    Caches

    Guild#members

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

    Parameters

    • guildID: string

      The ID of the guild.

    • Optional options: GetMembersOptions

      The options for getting the members.

    Returns Promise<Member[]>

    Caching

    This method may cache its result. The result will not be cached if the guild is not cached.

    Caches

    Guild#members}

  • Get the prune count of a guild.

    Parameters

    • guildID: string

      The ID of the guild.

    • Optional options: GetPruneCountOptions

      The options for getting the prune count.

    Returns Promise<number>

    Caching

    This method does not cache its result.

  • Get a scheduled event.

    Parameters

    • guildID: string

      The ID of the guild.

    • 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>

    Caching

    This method may cache its result. The result will not be cached if the guild is not cached.

    Caches

    Guild#scheduledEvents

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

    Parameters

    • guildID: string

      The ID of the guild.

    • stickerID: string

      The ID of the sticker to get.

    Returns Promise<Sticker>

    Caching

    This method may cache its result. The result will not be cached if the guild is not cached.

    Caches

    Guild#stickers

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

    Parameters

    • guildID: string

      The ID of the guild.

    Returns Promise<Sticker[]>

    Caching

    This method may cache its result. The result will not be cached if the guild is not cached.

    Caches

    Guild#stickers (will be completely cleared and refilled)

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

    Parameters

    • guildID: string

      The ID of the guild.

    Returns Promise<VoiceRegion[]>

    Caching

    This method does not cache its result.

  • Get the widget image of a guild.

    Parameters

    • guildID: string

      The ID of the guild.

    • Optional style: WidgetImageStyle

      The style of the image.

    Returns Promise<Buffer>

    Caching

    This method does not cache its result.

  • Remove a ban.

    Parameters

    • guildID: string

      The ID of the guild.

    • userID: string

      The ID of the user to remove the ban from.

    • Optional reason: string

      The reason for removing the ban.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Remove a member from a guild.

    Parameters

    • guildID: string

      The ID of the guild.

    • memberID: string

      The ID of the user to remove.

    • Optional reason: string

      The reason for the removal.

    Returns Promise<void>

    Caching

    This method does not cache its result.

  • Remove a role from a member.

    Parameters

    • guildID: string

      The ID of the guild.

    • 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>

    Caching

    This method does not cache its result.