Client

Client

new Client(privateKey, optionsopt)

Source:
See:
Properties:
Name Type Description
messages Collection:Message
roles Collection:Role
users Collection:User
channels Collection:Channel
pings Array:Float Time it took for the last 10 responses in ms.
ping Float Average of pings.
user User
Parameters:
Name Type Attributes Description
privateKey String Hex encoded secp521r1 private key. See generatePrivateKey to generate one.
options Object <optional>
Properties
Name Type Attributes Description
url Object <optional>
WebSocket endpoint.
Fires:
  • event:loggedin Signed into server.
  • ready Retrieved users, roles,event: and channels.
  • event:newmsg
  • event:msgedited
  • event:msgdeleted
  • event:msgpinned
  • event:msgunpinned
  • event:channeladded
  • event:channeedited
  • event:channeldeleted
  • event:roleadded
  • event:roleedited
  • event:roledeleted
  • event:roleaddedtouser
  • event:roleremovedfromuser
Throws:
need a private key

Extends

  • WS

Methods

createChannel(properties) → {Promise}

Source:
See:
  • Channel.createChild
Parameters:
Name Type Description
properties Object
Properties
Name Type Attributes Description
name String
description String
pID Int <optional>
Parent id. Defaults to no parent.
order Int
type String/Int 0: text, 1: category
perms Object <optional>
Role permission overrides. Format is {roleId: permString}.
Throws:
  • invalid properties
  • parent isnt a category channel
Returns:
Type
Promise

createRole(properties) → {Promise}

Source:
See:
Example
Bot.createRole({
	name: "testing role",
	color: "#8a00ff",
	priority: 0,
	hoisted: true,
	globalPerms: "1tintc/9of/0",
	baseChannelPerms: "19a3oe1ivr/1/1dor0/5/2kc0"
});
Parameters:
Name Type Description
properties Object Can either use the DMC.wrap or DMC.chat API names, but they need to be the same format as in the DMC.chat API docs. DMC.wrap names are listed below.
Properties
Name Type Description
name String
colour String
priority Int
hoisted Bool
globalPerms String
baseChannelPerms String
Throws:
invalid properties
Returns:
Type
Promise

request(type, dataopt) → {Promise}

Source:
Makes a direct message to the WebSocket. You shouldn't need to use this.
Parameters:
Name Type Attributes Description
type String
data Object <optional>
Returns:
Type
Promise

setAvatar(path) → {Promise.<User>}

Source:
To Do:
  • Automatically crop.
Parameters:
Name Type Description
path String Path/URL to pic to set as avatar. Has to be square.
Returns:
Type
Promise.<User>