Options
All
  • Public
  • Public/Protected
  • All
Menu

Methods for interacting with users

Hierarchy

  • UserMethods

Index

Constructors

  • Create a new User Method handler

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

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

    Parameters

    Returns <internal>.UserMethods

Properties

requestHandler: <internal>.RequestHandler
default: typeof <internal>.UserMethods

Methods

  • Create a direct message channel with another user

    You can not create a dm with another bot

    example

    // Create a dm channel and send "hi" to it const client = new SnowTransfer("TOKEN") const channel = await client.user.createDirectMessageChannel("other user id") client.channel.createMessage(channel.id, "hi")

    Parameters

    • userId: string

      Id of the user to create the direct message channel with

    Returns Promise<<internal>.DMChannel>

  • Get information about the CurrentUser

    example

    const client = new SnowTransfer("TOKEN") const self = await client.user.getSelf()

    Returns Promise<<internal>.User>

    A user object

    OAUTH2 Scopes Condition
    identify Without email
    email With email
  • leaveGuild(guildId: string): Promise<void>
  • Leaves a guild

    example

    const client = new SnowTransfer("TOKEN") client.user.leaveGuild("guildId")

    Parameters

    • guildId: string

      Id of the guild

    Returns Promise<void>

    Resolves the Promise on successful execution

  • Update the current user

    example

    // update the avatar of the user const client = new SnowTransfer("TOKEN") const fileData = fs.readFileSync("new_avatar.png") // You should probably use fs.readFile, since it is asynchronous, synchronous methods may lag your bot. const updateData = { avatar: data:image/png;base64,${fileData.toString("base64")} // base64 data url: data:mimetype;base64,base64String } client.user.updateSelf(updateData)

    Parameters

    • data: { avatar?: null | string; username?: string }

      The new data of the CurrentUser

      • Optional avatar?: null | string
      • Optional username?: string

    Returns Promise<<internal>.User>

Generated using TypeDoc