Add TextBasedChannel#nsfw (excluding User and GuildMember) (#1419)

This commit is contained in:
Gus Caplan
2017-04-26 17:01:27 -05:00
committed by Amish Shah
parent 298ee4e79f
commit 5ac22691d2
3 changed files with 13 additions and 1 deletions

View File

@@ -172,6 +172,7 @@ class GroupDMChannel extends Channel {
awaitMessages() {}
// Doesn't work on group DMs; bulkDelete() {}
acknowledge() {}
get nsfw() {}
_cacheMessage() {}
}

View File

@@ -88,6 +88,7 @@ class TextChannel extends GuildChannel {
stopTyping() {}
get typing() {}
get typingCount() {}
get nsfw() {}
createCollector() {}
createMessageCollector() {}
awaitMessages() {}

View File

@@ -389,6 +389,15 @@ class TextBasedChannel {
return this.client.rest.methods.ackTextChannel(this);
}
/**
* If the Discord Client considers this channel NSFW
* @type {boolean}
* @readonly
*/
get nsfw() {
return /^nsfw(-|$)/.test(this.name);
}
_cacheMessage(message) {
const maxSize = this.client.options.messageCacheMaxSize;
if (maxSize === 0) return null;
@@ -493,7 +502,8 @@ exports.applyToClass = (structure, full = false, ignore = []) => {
'fetchPinnedMessages',
'createCollector',
'createMessageCollector',
'awaitMessages'
'awaitMessages',
'nsfw'
);
}
for (const prop of props) {