mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 12:33:30 +01:00
add DMChannel docs
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -3,6 +3,11 @@ const TextBasedChannel = require('./interface/TextBasedChannel');
|
|||||||
const User = require('./User');
|
const User = require('./User');
|
||||||
const TextChannelDataStore = require('./datastore/TextChannelDataStore');
|
const TextChannelDataStore = require('./datastore/TextChannelDataStore');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a Direct Message Channel between two users.
|
||||||
|
* @extends {Channel}
|
||||||
|
* @implements {TextBasedChannel}
|
||||||
|
*/
|
||||||
class DMChannel extends Channel {
|
class DMChannel extends Channel {
|
||||||
constructor(client, data) {
|
constructor(client, data) {
|
||||||
super(client, data);
|
super(client, data);
|
||||||
@@ -26,13 +31,34 @@ class DMChannel extends Channel {
|
|||||||
|
|
||||||
setup(data) {
|
setup(data) {
|
||||||
super.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]));
|
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;
|
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() {
|
toString() {
|
||||||
return this.recipient.toString();
|
return this.recipient.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendMessage() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendTTSMessage() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TextBasedChannel.applyToClass(DMChannel);
|
TextBasedChannel.applyToClass(DMChannel);
|
||||||
|
|||||||
Reference in New Issue
Block a user