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

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 direct messages of a user

    Returns an empty array for bots

    Returns Promise<<internal>.DMChannel[]>

    Array of dm channels

  • leaveGuild(guildId: string): Promise<void>
  • Leave a guild

    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's 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?: string; username?: string }
      • Optional avatar?: string
      • Optional username?: string

    Returns Promise<Required<<internal>.User>>

Generated using TypeDoc