Files
discord.js/src/structures/DMChannel.js
SpaceEEC 65d9d46a3c Fixed DataStore, deprecation leftovers and a bit of Event Constants (#1841)
* Fixed leftover fetchThing and removed unused methods/error messages

* Added resume event constant and used event constants wherever possible

* Replaced mentions of removed method name with their new name.

* Fixed typo: resume -> resumed
2017-08-28 00:11:28 +02:00

56 lines
1.4 KiB
JavaScript

const Channel = require('./Channel');
const TextBasedChannel = require('./interfaces/TextBasedChannel');
const MessageStore = require('../stores/MessageStore');
/**
* Represents a direct message channel between two users.
* @extends {Channel}
* @implements {TextBasedChannel}
*/
class DMChannel extends Channel {
constructor(client, data) {
super(client, data);
this.messages = new MessageStore(this);
this._typing = new Map();
}
_patch(data) {
super._patch(data);
/**
* The recipient on the other end of the DM
* @type {User}
*/
this.recipient = this.client.users.create(data.recipients[0]);
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();
}
// These are here only for documentation purposes - they are implemented by TextBasedChannel
/* eslint-disable no-empty-function */
send() {}
search() {}
startTyping() {}
stopTyping() {}
get typing() {}
get typingCount() {}
createMessageCollector() {}
awaitMessages() {}
// Doesn't work on DM channels; bulkDelete() {}
acknowledge() {}
_cacheMessage() {}
}
TextBasedChannel.applyToClass(DMChannel, true, ['bulkDelete']);
module.exports = DMChannel;