refactor(Channel): change channel types to UPPER_CASE (#6035)

This commit is contained in:
Rodry
2021-07-08 21:32:19 +01:00
committed by GitHub
parent b170fb5ce8
commit 6301728d35
26 changed files with 190 additions and 154 deletions

View File

@@ -552,7 +552,7 @@ class Message extends Base {
*/
get crosspostable() {
return (
this.channel.type === 'news' &&
this.channel.type === 'GUILD_NEWS' &&
!this.flags.has(MessageFlags.FLAGS.CROSSPOSTED) &&
this.type === 'DEFAULT' &&
this.channel.viewable &&
@@ -595,7 +595,7 @@ class Message extends Base {
* @returns {Promise<Message>}
* @example
* // Crosspost a message
* if (message.channel.type === 'news') {
* if (message.channel.type === 'GUILD_NEWS') {
* message.crosspost()
* .then(() => console.log('Crossposted message'))
* .catch(console.error);
@@ -713,7 +713,7 @@ class Message extends Base {
* @returns {Promise<ThreadChannel>}
*/
startThread(name, autoArchiveDuration, reason) {
if (!['text', 'news'].includes(this.channel.type)) {
if (!['GUILD_TEXT', 'GUILD_NEWS'].includes(this.channel.type)) {
return Promise.reject(new Error('MESSAGE_THREAD_PARENT'));
}
return this.channel.threads.create({ name, autoArchiveDuration, startMessage: this, reason });