add DMChannel docs

This commit is contained in:
Amish Shah
2016-08-18 18:57:20 +01:00
parent 3e3a411a42
commit 863495cda0
2 changed files with 27 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -3,6 +3,11 @@ const TextBasedChannel = require('./interface/TextBasedChannel');
const User = require('./User');
const TextChannelDataStore = require('./datastore/TextChannelDataStore');
/**
* Represents a Direct Message Channel between two users.
* @extends {Channel}
* @implements {TextBasedChannel}
*/
class DMChannel extends Channel {
constructor(client, data) {
super(client, data);
@@ -26,13 +31,34 @@ class DMChannel extends Channel {
setup(data) {
super.setup(data);
/**
* The recipient on the other end of the DM
* @type {User}
*/
this.recipient = this.client.store.add('users', new User(this.client, data.recipients[0]));
/**
* The ID of the last sent message, if available
* @type {?String}
*/
this.lastMessageID = data.last_message_id;
}
/**
* When concatenated with a String, this automatically concatenates the recipient's mention instead of the
* DM channel object.
* @returns {String}
*/
toString() {
return this.recipient.toString();
}
sendMessage() {
return;
}
sendTTSMessage() {
return;
}
}
TextBasedChannel.applyToClass(DMChannel);