mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
60 lines
1.6 KiB
JavaScript
60 lines
1.6 KiB
JavaScript
const User = require('./User');
|
|
const Channel = require('./Channel');
|
|
const TextBasedChannel = require('./interface/TextBasedChannel');
|
|
const Collection = require('../util/Collection');
|
|
|
|
/**
|
|
* 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 Collection();
|
|
}
|
|
|
|
setup(data) {
|
|
super.setup(data);
|
|
|
|
/**
|
|
* The recipient on the other end of the DM
|
|
* @type {User}
|
|
*/
|
|
this.recipient = this.client.users.get(data.recipients[0].id) || new User(this.client, data.recipients[0]);
|
|
|
|
this.type = 'dm';
|
|
this.lastMessageID = data.last_message_id;
|
|
this._typing = new Map();
|
|
}
|
|
|
|
/**
|
|
* 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
|
|
sendMessage() { return; }
|
|
sendTTSMessage() { return; }
|
|
sendFile() { return; }
|
|
fetchMessage() { return; }
|
|
fetchMessages() { return; }
|
|
fetchPinnedMessages() { return; }
|
|
startTyping() { return; }
|
|
stopTyping() { return; }
|
|
get typing() { return; }
|
|
get typingCount() { return; }
|
|
createCollector() { return; }
|
|
awaitMessages() { return; }
|
|
bulkDelete() { return; }
|
|
_cacheMessage() { return; }
|
|
}
|
|
|
|
TextBasedChannel.applyToClass(DMChannel, true);
|
|
|
|
module.exports = DMChannel;
|