Methods - Client

Connection

connect
Connects the client to Discord's websocket manually.
client.connect()

disconnect
Disconnects the client from Discord's websocket.
client.disconnect()

User Information

editUserInfo
Changes the user's information, on Discord's servers
client.editUserInfo( {opts} [, callback] );
  • opts:
    • avatar: A base64 string of your image. require('fs').readFileSync('file.ext', 'base64') is enough, or you can provide it some other way
    • email: The email for your user, not useful for bot accounts
    • password: The password for your user, not useful for bot accounts, required if you're changing passwords
    • new_password: The new password for your user, password is required if you fill this out
    • username: The new username.
  • callback
    • error
    • response

setPresence
Changes the user's presence
client.setPresence( {opts} );
  • opts
    • idle_since: Used to set your presence to idle. It requires an arbitrary Number before the current time, Date.now() works. Set to null to revert back to online.
    • game
      • name: The name you want to display. Will show up as Playing [Name].
      • type: A Number indicating Discord's streaming type. Right now only 1 (Twitch) works.
      • url: The URL they will visit when they choose to view your stream. The URL must match the service you're streaming on, in order to be usable.

setPresence (1.x.x)
Changes the user's presence
client.setPresence( {opts} );
  • opts
    • idle_since: Used to set your presence to idle. It requires an arbitrary Number before the current time, Date.now() works. Set to null to revert back to online.
    • --Below may change--
    • game: The title of the game you want others to see you playing.
    • type: A Number indicating Discord's streaming type. Right now only 1 (Twitch) works.
    • url: The Twitch URL you wish people to see when they choose to visit your livestream.

getOauthInfo
Retrieves the OAuth information for the user, only used by bot type accounts.
client.getOauthInfo(callback);
  • callback
    • error
    • response

getAccountSettings
Retrieves the account settings for the user.
client.getAccountSettings(callback);
  • callback
    • error
    • response

miscellaneous

getAllUsers
Retrieves the offline (and online, for user-type accounts) users from Discord. The callback argument is just an error.
client.getAllUsers(callback);
  • callback
    • error

getOfflineUsers (1.x.x)
Retrieves the offline users from Discord. The callback is just an error one, as it's received as a burst of websocket GUILD_MEMBERS_CHUNK events. May be changed later.
client.getOfflineUsers(callback);
  • callback
    • error

fixMessage
Use this to resolve user and channel mentions in the received message.
client.fixMessage(message);
  • message: The message given by an event..

setGlobalRequestDelay (1.x.x)
Sets a delay on all REST requests, not needed for most operations.
client.setGlobalRequestDelay(num);
  • num: A number greater than 0.

serverFromChannel (1.x.x)
An older method to get the server ID from a channel. Uses loops, so not recommended. Accessing bot.channels[channelID].guild_id is faster.
var serverID = client.serverFromChannel(channelID);
  • channelID: A channel ID of a channel that belongs to a server.

results matching ""

    No results matching ""