Options
All
  • Public
  • Public/Protected
  • All
Menu

Methods for interacting with Guilds

Hierarchy

  • GuildMethods

Index

Constructors

  • Create a new Guild Method Handler

    Usually SnowTransfer creates a method handler for you, this is here for completion

    You can access the methods listed via client.guild.method, where client is an initialized SnowTransfer instance

    Parameters

    Returns <internal>.GuildMethods

Properties

requestHandler: <internal>.RequestHandler

Methods

  • Add a guild member to a guild via oauth2 access token

    You need the oauth2 guilds.join scope granted to the access_token

    Your bot has to be a member of the guild you want to add the user to

    example

    // add a user to a server const client = new SnowTransfer('TOKEN') const memberData = { access_token: 'access token of a user with the guilds.join scope' } client.guild.addGuildMember('guildId', 'memberId', memberData)

    Parameters

    • guildId: string

      Id of the guild

    • memberId: string

      Id of the guild member

    • data: <internal>.AddGuildMemberData

      object containing the needed request data

    Returns Promise<<internal>.Member>

    (https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure)

    Permissions needed Condition
    CREATE_INSTANT_INVITE always
    OAUTH2 Scopes
    guilds.join
  • addGuildMemberRole(guildId: string, memberId: string, roleId: string, data?: { reason?: string }): Promise<void>
  • Add a role to a guild member

    Parameters

    • guildId: string

      Id of the guild

    • memberId: string

      Id of the guild member

    • roleId: string

      Id of the role

    • Optional data: { reason?: string }

      object with reason property

      • Optional reason?: string

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    MANAGE_ROLES always
  • createGuildBan(guildId: string, memberId: string, data?: { delete_message_days?: number; reason?: string }): Promise<void>
  • Ban a guild member

    example

    // Ban a user with a reason and delete the last 2 days of their messages const client = new SnowTransfer('TOKEN') const banData = { reason: 'Memes were not good enough', delete_message_days":2 } client.guild.createGuildBan('guild Id', 'memberId', banData)

    Parameters

    • guildId: string

      Id of the guild

    • memberId: string

      Id of the guild member

    • Optional data: { delete_message_days?: number; reason?: string }

      object with a reason and a delete-message-days property

      • Optional delete_message_days?: number
      • Optional reason?: string

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    BAN_MEMBERS always
  • createGuildIntegration(guildId: string, data: { id: string; type: string }): Promise<void>
  • Attach a integration object from the user to the guild

    Parameters

    • guildId: string

      Id of the guild

    • data: { id: string; type: string }

      Integration object with id and type properties

      • id: string
      • type: string

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    MANAGE_GUILD always
  • createGuildTimeout(guildId: string, memberId: string, data: { communication_disabled_until?: string; reason?: string }): Promise<void>
  • example

    // Timeout a user with a reason and disable their communication for 1 week const client = new SnowTransfer('TOKEN') const timeoutData = { reason: 'Bad words', "communication_disabled_until": new Date(Date.now() + 604800000).toISOString() } client.guild.createGuildTimeout('guild Id', 'memberId', timeoutData)

    Parameters

    • guildId: string

      Id of the guild

    • memberId: string

      Id of the guild member

    • data: { communication_disabled_until?: string; reason?: string }

      object with a reason and a communication_disabled_until property

      • Optional communication_disabled_until?: string
      • Optional reason?: string

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions deeded Condition
    MODERATE_MEMBERS always
  • deleteGuild(guildId: string): Promise<void>
  • Delete a guild

    Your bot has to be the owner of the guild to do this

    This action is irreversible, so use it with caution!

    Parameters

    • guildId: string

      Id of the guild

    Returns Promise<void>

    Resolves the Promise on successful execution

  • getGuildIntegrations(guildId: string): Promise<any[]>
  • Get integrations for a guild

    Parameters

    • guildId: string

      Id of the guild

    Returns Promise<any[]>

    List of integration objects

    Permissions needed Condition
    MANAGE_GUILD always
  • getGuildInvites(guildId: string): Promise<any[]>
  • Get invites for a guild

    Parameters

    • guildId: string

      Id of the guild

    Returns Promise<any[]>

    List of invites (with metadata)

    Permissions needed Condition
    MANAGE_GUILD always
  • getGuildPruneCount(guildId: string, data: { days?: number; include_roles?: string }): Promise<{ pruned: number }>
  • Get the amount of members that would be pruned when a prune with the passed amount of days would be started

    Parameters

    • guildId: string

      Id of the guild

    • data: { days?: number; include_roles?: string }

      Object with a days property

      • Optional days?: number
      • Optional include_roles?: string

    Returns Promise<{ pruned: number }>

    Object with a "pruned" key indicating the amount of members that would be pruned

    Permissions needed Condition
    KICK_MEMBERS always
  • Get a list of roles for a guild

    Parameters

    • guildId: string

      Id of the guild

    Returns Promise<<internal>.Role[]>

    array of roles

    Permissions needed Condition
    MANAGE_ROLES always
  • getGuildVanityURL(guildId: string): Promise<{ code: null | string; uses: number }>
  • Get a guild's vanity URL code

    Parameters

    • guildId: string

      Id of the guild

    Returns Promise<{ code: null | string; uses: number }>

    partial invite object

    Permissions needed Condition
    MANAGE_GUILD always
  • getGuildVoiceRegions(guildId: string): Promise<any[]>
  • Get a list of voice regions for the guild, includes vip-regions unlike voice.getVoiceRegions

    Parameters

    • guildId: string

      Id of the guild

    Returns Promise<any[]>

    List of voice regions

  • getGuildWidgetSettings(guildId: string): Promise<{ channel_id: string; enabled: boolean }>
  • removeGuildBan(guildId: string, memberId: string, data?: { reason?: string }): Promise<void>
  • Remove a ban of a user

    Parameters

    • guildId: string

      Id of the guild

    • memberId: string

      Id of the guild member

    • Optional data: { reason?: string }

      object with a reason property

      • Optional reason?: string

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    BAN_MEMBERS always
  • removeGuildIntegration(guildId: string, integrationId: string): Promise<void>
  • Delete a guild integratiom

    Parameters

    • guildId: string

      Id of the guild

    • integrationId: string

      Id of the integration

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    MANAGE_GUILD always
  • removeGuildMember(guildId: string, memberId: string, data?: { reason?: string }): Promise<void>
  • Remove a guild member (aka kick them)

    example

    // Kick a member with a reason of "spam" const client = new SnowTransfer('TOKEN') const kickData = { reason: 'spam' } client.guild.removeGuildMember('guild Id', 'memberId', kickData)

    Parameters

    • guildId: string

      Id of the guild

    • memberId: string

      Id of the guild member

    • Optional data: { reason?: string }

      object with reason property

      • Optional reason?: string

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    KICK_MEMBERS always
  • removeGuildMemberRole(guildId: string, memberId: string, roleId: string, data?: { reason?: string }): Promise<void>
  • Remove a role from a guild member

    Parameters

    • guildId: string

      Id of the guild

    • memberId: string

      Id of the guild member

    • roleId: string

      Id of the role

    • Optional data: { reason?: string }

      object with reason property

      • Optional reason?: string

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    MANAGE_ROLES always
  • removeGuildRole(guildId: string, roleId: string): Promise<void>
  • Delete a role from the guild

    Parameters

    • guildId: string

      Id of the guild

    • roleId: string

      Id of the role

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    MANAGE_ROLES always
  • Get a list of guild members that match a query

    Parameters

    • guildId: string

      Id of the guild

    • options: { limit?: number; query?: string }

      query data

      • Optional limit?: number
      • Optional query?: string

    Returns Promise<<internal>.Member[]>

    list of guild members

  • startGuildPrune(guildId: string, data: { compute_prune_count?: boolean; days?: number; include_roles?: string[]; reason?: string }): Promise<{ pruned: number }>
  • Start a prune

    Parameters

    • guildId: string

      Id of the guild

    • data: { compute_prune_count?: boolean; days?: number; include_roles?: string[]; reason?: string }

      Object with a days property

      • Optional compute_prune_count?: boolean
      • Optional days?: number
      • Optional include_roles?: string[]
      • Optional reason?: string

    Returns Promise<{ pruned: number }>

    Object with a "pruned" key indicating the amount of members that were pruned

    Permissions needed Condition
    KICK_MEMBERS always
  • updateChannelPositions(guildId: string, data: { id: string; lock_permissions?: null | boolean; parent_id?: null | string; position?: null | number }[]): Promise<void>
  • Batch update the positions of channels

    Parameters

    • guildId: string

      Id of the guild

    • data: { id: string; lock_permissions?: null | boolean; parent_id?: null | string; position?: null | number }[]

    Returns Promise<void>

    Resolves the Promise on successful execution

  • updateCurrentUserVoiceState(guildId: string, data: { channel_id: string; request_to_speak_timestamp: null | string; suppress?: boolean }): Promise<void>
  • Updates the current user's voice state in a stage channel

    Parameters

    • guildId: string

      Id of the guild

    • data: { channel_id: string; request_to_speak_timestamp: null | string; suppress?: boolean }

      Data of the voice state

      • channel_id: string
      • request_to_speak_timestamp: null | string
      • Optional suppress?: boolean

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    MUTE_MEMBERS when trying to un-suppress yourself
    REQUEST_TO_SPEAK when trying to request to speak
  • updateGuildIntegration(guildId: string, integrationId: string, data: { enable_emoticons: boolean; expire_behavior: number; expire_grace_period: number }): Promise<void>
  • Update behaviour and settings of an integration object

    Parameters

    • guildId: string

      Id of the guild

    • integrationId: string

      Id of the integration

    • data: { enable_emoticons: boolean; expire_behavior: number; expire_grace_period: number }
      • enable_emoticons: boolean
      • expire_behavior: number
      • expire_grace_period: number

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    MANAGE_GUILD always
  • Update properties of a guild member

    Check the table below to make sure you have the right permissions for the types of updates

    Make sure that your bot has CONNECT and MOVE_MEMBERS on the channel you want to move the member to

    example

    // Reset the nickname of a guild member const client = new SnowTransfer('TOKEN') const memberData = { nick: "" // You can reset nicknames by providing an empty string as the value of data.nick } client.guild.updateGuildMember('guild Id', 'memberId', memberData)

    Parameters

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    MANAGE_NICKNAMES Nick Updates
    MANAGE_ROLES Role Updates
    MUTE_MEMBERS Mute Updates
    DEAFEN_MEMBERS Deaf Updates
    MOVE_MEMBERS Voice Move
  • updateGuildRolePositions(guildId: string, data: { id: string; position?: null | number; reason?: string } | { id: string; position?: null | number; reason?: string }[]): Promise<<internal>.Role[]>
  • Modify the positions of a role or multiple roles

    Parameters

    • guildId: string

      Id of the guild

    • data: { id: string; position?: null | number; reason?: string } | { id: string; position?: null | number; reason?: string }[]

      Role data to update

    Returns Promise<<internal>.Role[]>

    array of roles

    Permissions needed Condition
    MANAGE_ROLES always
  • updateGuildWidgetSettings(guildId: string, data: { channel_id?: string; enabled?: boolean }): Promise<{ channel_id: string; enabled: boolean }>
  • Update a guild widget settings object

    Parameters

    • guildId: string

      Id of the guild

    • data: { channel_id?: string; enabled?: boolean }

      basic data of widget settings

      • Optional channel_id?: string
      • Optional enabled?: boolean

    Returns Promise<{ channel_id: string; enabled: boolean }>

    (https://discord.com/developers/docs/resources/guild#guild-widget-object)

    Permissions needed Condition
    MANAGE_GUILD always
  • updateSelf(guildId: string, data: { nick: string }): Promise<void>
  • Update the nick of the current user

    example

    // change nick of bot to "Nice Nick" const client = new SnowTransfer('TOKEN') const nickData = { nick: 'Nice Nick' } client.guild.updateSelf('guildId', nickData)

    Parameters

    • guildId: string

      Id of the guild

    • data: { nick: string }

      object with a nick property

      • nick: string

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    CHANGE_NICKNAME always
  • updateUserVoiceState(guildId: string, userId: string, data: { channel_id: string; suppress?: boolean }): Promise<void>
  • Updates a user's voice state in a stage channel

    Parameters

    • guildId: string

      Id of the guild

    • userId: string
    • data: { channel_id: string; suppress?: boolean }

      Data of the voice state

      • channel_id: string
      • Optional suppress?: boolean

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    MUTE_MEMBERS when trying to suppress/un-suppress

Generated using TypeDoc