Class REST/Guilds

Various methods for interacting with guilds. Located at Client#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

    See

    Add Guild Member

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

    See

    Add Guild Member Role

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

    See

    Create Guild Ban

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

    See

    Delete Auto Moderation Rule

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

    See

    Delete Guild Emoji

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

    See

    Delete Guild Integration

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

    See

    Delete Guild Role

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

    See

    Delete Guild Scheduled Event

  • Delete an exception to the recurrence rule for a scheduled event.

    Parameters

    • guildID: string

      The ID of the guild.

    • eventID: string

      The ID of the scheduled event.

    • exceptionID: string

      The ID of the scheduled event exception.

    • Optional reason: string

      The reason for deleting the scheduled event exception.

    Returns Promise<void>

    Caching

    This method may remove the result from cache. The result will not be removed if the scheduled event is not cached.

    Caches

    GuildScheduledEvent#exceptions

    See

    Delete Guild Scheduled Event Exception (docs.discord.food)

  • Parameters

    • guildID: string

      The ID of the guild.

    • soundID: string

      The ID of the soundboard sound to delete.

    • Optional reason: string

      The reason for deleting the soundboard sound.

    Returns Promise<void>

    Caching

    This method does not cache its result.

    See

    Delete Guild Soundboard Sound

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

    See

    Delete Guild Sticker

  • 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

    See

    Modify Guild Member

  • 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

    See

    Get Guild

  • 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

    See

    Get Guild Sticker

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

    See

    List Guild Stickers

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

    See

    Remove Guild Ban

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

    See

    Remove Guild Member

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

    See

    Remove Guild Member Role