mirror of
https://github.com/danbulant/discord.js
synced 2026-07-04 02:30:45 +00:00
Add channel.type
This commit is contained in:
parent
64b0e6bc84
commit
8d094cdfb1
7 changed files with 14 additions and 9 deletions
File diff suppressed because one or more lines are too long
|
|
@ -13,7 +13,15 @@ class Channel {
|
||||||
if (guild) {
|
if (guild) {
|
||||||
this.guild = 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) {
|
if (data) {
|
||||||
this.setup(data);
|
this.setup(data);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ class DMChannel extends Channel {
|
||||||
* @type {?String}
|
* @type {?String}
|
||||||
*/
|
*/
|
||||||
this.lastMessageID = data.last_message_id;
|
this.lastMessageID = data.last_message_id;
|
||||||
|
this.type = 'dm';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ class GroupDMChannel extends Channel {
|
||||||
* @type {User}
|
* @type {User}
|
||||||
*/
|
*/
|
||||||
this.owner = this.client.users.get(data.owner_id);
|
this.owner = this.client.users.get(data.owner_id);
|
||||||
|
this.type = 'group';
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage() {
|
sendMessage() {
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,6 @@ class GuildChannel extends Channel {
|
||||||
|
|
||||||
setup(data) {
|
setup(data) {
|
||||||
super.setup(data);
|
super.setup(data);
|
||||||
/**
|
|
||||||
* The type of the Guild Channel
|
|
||||||
* @type {String}
|
|
||||||
*/
|
|
||||||
if (data.type === 0) this.type = 'text';
|
|
||||||
else if (data.type === 2) this.type = 'voice';
|
|
||||||
else this.type = data.type.toString();
|
|
||||||
/**
|
/**
|
||||||
* The topic of the Guild Channel, if there is one.
|
* The topic of the Guild Channel, if there is one.
|
||||||
* @type {?String}
|
* @type {?String}
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ class TextChannel extends GuildChannel {
|
||||||
* @type {?String}
|
* @type {?String}
|
||||||
*/
|
*/
|
||||||
this.lastMessageID = data.last_message_id;
|
this.lastMessageID = data.last_message_id;
|
||||||
|
this.type = 'text';
|
||||||
}
|
}
|
||||||
|
|
||||||
sendMessage() {
|
sendMessage() {
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ class VoiceChannel extends GuildChannel {
|
||||||
* @type {Number}
|
* @type {Number}
|
||||||
*/
|
*/
|
||||||
this.userLimit = data.user_limit;
|
this.userLimit = data.user_limit;
|
||||||
|
this.type = 'voice';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue