discord.js/src/structures/Channel.js
Schuyler Cebulskie 27652b94af Make JSDocs follow general conventions (#582)
* Make JSDocs follow usual conventions

* Fix StringResolvable name

* Make function lowercase
2016-09-03 09:57:25 +01:00

52 lines
1 KiB
JavaScript

/**
* Represents any Channel on Discord
*/
class Channel {
constructor(client, data, guild) {
/**
* The client that instantiated the Channel
* @type {Client}
*/
this.client = client;
this.typingMap = {};
this.typingTimeouts = [];
if (guild) {
this.guild = guild;
}
/**
* The type of the channel, either:
* * `dm` - a DM channel
* * `group` - a Group DM channel
* * `text` - a guild text channel
* * `voice` - a guild voice channel
* @type {string}
*/
this.type = null;
if (data) {
this.setup(data);
}
}
setup(data) {
/**
* The unique ID of the channel
* @type {string}
*/
this.id = data.id;
}
/**
* Deletes the channel
* @return {Promise<Channel>}
* @example
* // delete the channel
* channel.delete()
* .then() // success
* .catch(console.log); // log error
*/
delete() {
return this.client.rest.methods.deleteChannel(this);
}
}
module.exports = Channel;