diff --git a/src/errors/Messages.js b/src/errors/Messages.js index cc5b2c60f3c8..d24ae15e43a2 100644 --- a/src/errors/Messages.js +++ b/src/errors/Messages.js @@ -92,7 +92,7 @@ const Messages = { GUILD_OWNED: 'Guild is owned by the client.', GUILD_MEMBERS_TIMEOUT: "Members didn't arrive in time.", GUILD_UNCACHED_ME: 'The client user as a member of this guild is uncached.', - NO_GUILD_CHANNEL: 'Could not find the channel where this message came from! It may have been deleted.', + CHANNEL_NOT_CACHED: 'Could not find the channel where this message came from in the cache!', STAGE_CHANNEL_RESOLVE: 'Could not resolve channel to a stage channel.', INVALID_TYPE: (name, expected, an = false) => `Supplied ${name} is not a${an ? 'n' : ''} ${expected}.`, diff --git a/src/structures/Message.js b/src/structures/Message.js index c17188ec074e..fa1dbea7d8b2 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -632,7 +632,7 @@ class Message extends Base { * .catch(console.error); */ edit(options) { - if (!this.channel) return Promise.reject(new Error('NO_GUILD_CHANNEL')); + if (!this.channel) return Promise.reject(new Error('CHANNEL_NOT_CACHED')); return this.channel.messages.edit(this, options); } @@ -648,7 +648,7 @@ class Message extends Base { * } */ crosspost() { - if (!this.channel) return Promise.reject(new Error('NO_GUILD_CHANNEL')); + if (!this.channel) return Promise.reject(new Error('CHANNEL_NOT_CACHED')); return this.channel.messages.crosspost(this.id); } @@ -662,7 +662,7 @@ class Message extends Base { * .catch(console.error) */ async pin() { - if (!this.channel) throw new Error('NO_GUILD_CHANNEL'); + if (!this.channel) throw new Error('CHANNEL_NOT_CACHED'); await this.channel.messages.pin(this.id); return this; } @@ -677,7 +677,7 @@ class Message extends Base { * .catch(console.error) */ async unpin() { - if (!this.channel) throw new Error('NO_GUILD_CHANNEL'); + if (!this.channel) throw new Error('CHANNEL_NOT_CACHED'); await this.channel.messages.unpin(this.id); return this; } @@ -698,7 +698,7 @@ class Message extends Base { * .catch(console.error); */ async react(emoji) { - if (!this.channel) throw new Error('NO_GUILD_CHANNEL'); + if (!this.channel) throw new Error('CHANNEL_NOT_CACHED'); emoji = this.client.emojis.resolveIdentifier(emoji); await this.channel.messages.react(this.id, emoji); return this.client.actions.MessageReactionAdd.handle({ @@ -719,7 +719,7 @@ class Message extends Base { * .catch(console.error); */ async delete() { - if (!this.channel) throw new Error('NO_GUILD_CHANNEL'); + if (!this.channel) throw new Error('CHANNEL_NOT_CACHED'); await this.channel.messages.delete(this.id); return this; } @@ -742,7 +742,7 @@ class Message extends Base { * .catch(console.error); */ reply(options) { - if (!this.channel) return Promise.reject(new Error('NO_GUILD_CHANNEL')); + if (!this.channel) return Promise.reject(new Error('CHANNEL_NOT_CACHED')); let data; if (options instanceof MessagePayload) { @@ -774,7 +774,7 @@ class Message extends Base { * @returns {Promise} */ startThread(options = {}) { - if (!this.channel) return Promise.reject(new Error('NO_GUILD_CHANNEL')); + if (!this.channel) return Promise.reject(new Error('CHANNEL_NOT_CACHED')); if (!['GUILD_TEXT', 'GUILD_NEWS'].includes(this.channel.type)) { return Promise.reject(new Error('MESSAGE_THREAD_PARENT')); } @@ -788,7 +788,7 @@ class Message extends Base { * @returns {Promise} */ fetch(force = true) { - if (!this.channel) return Promise.reject(new Error('NO_GUILD_CHANNEL')); + if (!this.channel) return Promise.reject(new Error('CHANNEL_NOT_CACHED')); return this.channel.messages.fetch(this.id, { force }); }