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
default: typeof <internal>.GuildMethods

Methods

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

    CurrentUser must be a member of the guild

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

    example

    // add a role to a member with a reason of "I want to add a role" const client = new SnowTransfer("TOKEN") client.guild.addGuildMemberRole("guildId", "memberId", "roleId", { reason: "I want to add a role" })

    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
  • deleteGuild(guildId: string): Promise<void>
  • Delete a guild

    CurrentUser must be the owner of the guild

    This action is irreversible, so use it with caution!

    example

    const client = new SnowTransfer("TOKEN") client.guild.deleteGuild("guild id")

    Parameters

    • guildId: string

      Id of the guild

    Returns Promise<void>

    Resolves the Promise on successful execution

  • Get bans of a guild

    example

    const client = new SnowTransfer("TOKEN") const bans = await client.guild.getGuildBans("guildId")

    Parameters

    • guildId: string

      Id of the guild

    • Optional options: { after?: string; before?: string; limit?: number }

      Query string options

      • Optional after?: string
      • Optional before?: string
      • Optional limit?: number

    Returns Promise<<internal>."/home/runner/work/avocord/avocord/node_modules/discord-typings/Resources/Guild".Ban[]>

    List of bans

    Permissions needed Condition
    BAN_MEMBERS always
  • Get a list of guild members

    CurrentUser must be a member of the guild

    example

    // Gets 10 members from a guild const client = new SnowTransfer("TOKEN") const members = await client.guild.getGuildMembers("guild id", { limit: 10 })

    Parameters

    Returns Promise<<internal>.Member[]>

    list of guild members

    Intents
    GUILD_MEMBERS
  • getGuildPruneCount(guildId: string, query?: { 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

    example

    const client = new SnowTransfer("TOKEN") const data = await client.guild.getGuildPruneCount("guildId", { days: 7 })

    Parameters

    • guildId: string

      Id of the guild

    • Optional query: { days?: number; include_roles?: string }
      • 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

    example

    const client = new SnowTransfer("TOKEN") const roles = await client.guild.getGuildRoles("guildId")

    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

    example

    const client = new SnowTransfer("TOKEN") const vanityUrl = await client.guild.getGuildVanityUrl("guildId")

    Parameters

    • guildId: string

      Id of the guild

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

    partial invite object

    Permissions needed Condition
    MANAGE_GUILD always
  • Get a list of voice regions for the guild, includes vip-regions unlike voice.getVoiceRegions

    example

    const client = new SnowTransfer("TOKEN") const regions = await client.guild.getGuildVoiceRegions("guildId")

    Parameters

    • guildId: string

      Id of the guild

    Returns Promise<<internal>.VoiceRegion[]>

    List of voice regions

  • removeGuildBan(guildId: string, memberId: string, reason?: string): Promise<void>
  • Remove a ban of a user

    example

    // Remove a ban of a user with a reason const client = new SnowTransfer("TOKEN") client.guild.removeGuildBan("guildId", "memberId", "This guy was cool")

    Parameters

    • guildId: string

      Id of the guild

    • memberId: string

      Id of the guild member

    • Optional reason: string

      Reason for removing the ban

    Returns Promise<void>

    Resolves the Promise on successful execution

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

    example

    const client = new SnowTransfer("TOKEN") await client.guild.deleteGuildIntegration("guildId", "integrationId", "Didn't need anymore")

    Parameters

    • guildId: string

      Id of the guild

    • integrationId: string

      Id of the integration

    • Optional reason: string

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    MANAGE_GUILD always
  • removeGuildMember(guildId: string, memberId: string, 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") client.guild.removeGuildMember("guild Id", "memberId", "spam")

    Parameters

    • guildId: string

      Id of the guild

    • memberId: string

      Id of the guild member

    • Optional reason: string

      Reason for kicking the member

    Returns Promise<void>

    Resolves the Promise on successful execution

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

    example

    // remove a role from a member with a reason of "I want to remove a role" const client = new SnowTransfer("TOKEN") client.guild.removeGuildMemberRole("guildId", "memberId", "roleId", "I want to remove a role")

    Parameters

    • guildId: string

      Id of the guild

    • memberId: string

      Id of the guild member

    • roleId: string

      Id of the role

    • Optional reason: string

    Returns Promise<void>

    Resolves the Promise on successful execution

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

    example

    // Deletes a role with a reason "This role is too cool" const client = new SnowTransfer("TOKEN") client.guild.deleteGuildRole("guildId", "roleId", "This role is too cool")

    Parameters

    • guildId: string

      Id of the guild

    • roleId: string

      Id of the role

    • Optional reason: string

      Reason for deleting 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

    example

    // Gets all members with the username "Wolke" const client = new SnowTransfer("TOKEN") const members = await client.guild.searchGuildMembers("guild id", { query: "Wolke" })

    Parameters

    • guildId: string

      Id of the guild

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

      query data

      • Optional limit?: number
      • 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 }>
  • startGuildPrune(guildId: string, data: { compute_prune_count: false; days?: number; include_roles?: string[]; reason?: string }): Promise<{ pruned: null }>
  • Start a prune

    example

    const client = new SnowTransfer("TOKEN") const data = await client.guild.startGuildPrune("guildId", { days: 7 })

    Parameters

    • guildId: string

      Id of the guild

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

      Object with prune data

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

    • guildId: string
    • data: { compute_prune_count: false; days?: number; include_roles?: string[]; reason?: string }
      • compute_prune_count: false
      • Optional days?: number
      • Optional include_roles?: string[]
      • Optional reason?: string

    Returns Promise<{ pruned: null }>

  • 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. Only those being moved needs to be included here

    example

    // Sets the position of a channel to 2 under a category channel const client = new SnowTransfer("TOKEN") client.guild.updateChannelPositions("guild id", [{ id: "channel id", position: 2, category_id: "category id" }])

    Parameters

    • guildId: string

      Id of the guild

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

      Positional data to send

    Returns Promise<void>

    Resolves the Promise on successful execution

    Permissions needed Condition
    MANAGE_CHANNELS always
  • 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

    example

    // Unsuppresses the CurrentUser in the stage channel they're in const client = new SnowTransfer("TOKEN") client.guild.updateGuildVoiceState("guildId", { channel_id: "channel id", suppress: false })

    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
      • Optional 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
  • Update properties of a guild member

    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 } const member = await client.guild.updateGuildMember("guild Id", "memberId", memberData)

    Parameters

    Returns Promise<<internal>.Member>

    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
    CONNECT Voice Move
    MODERATE_MEMBERS Timeouts
  • Update a guild role

    example

    const client = new SnowTransfer("TOKEN") const roleData = { name: "Nicer Role", } client.guild.updateGuildRole("guildId", "roleId", roleData)

    Parameters

    • guildId: string

      Id of the guild

    • roleId: string

      Id of the role

    • data: <internal>.RoleOptions

      updated properties of the role

    Returns Promise<<internal>.Role>

    (https://discord.com/developers/docs/topics/permissions#role-object)

    Permissions needed Condition
    MANAGE_ROLES always
  • updateGuildRolePositions(guildId: string, data: { id: string; position?: null | number }[]): Promise<<internal>.Role[]>
  • Modify the positions of roles

    example

    const client = new SnowTransfer("TOKEN") const roles = await client.guild.updateGuildRolePositions("guildId", [{ id: "guild id", position: 1 }, { id: "role id 2", position: 2 }])

    Parameters

    • guildId: string

      Id of the guild

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

      Role data to update

    Returns Promise<<internal>.Role[]>

    array of roles

    Permissions needed Condition
    MANAGE_ROLES always
  • Update the nick of the CurrentMember

    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; reason?: string }

      object with a nick property and optionally, a reason property

      • nick: string
      • Optional reason?: string

    Returns Promise<<internal>.Member>

    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

    example

    // Suppresses the user in the stage channel they're in const client = new SnowTransfer("TOKEN") client.guild.updateGuildVoiceState("guildId", "userId", { channel_id: "channel id", suppress: true })

    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