mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 04:52:22 +00:00
Throwing 'Message not found' error when fetching from empty channel or without read history permission. (#1394)
This commit is contained in:
parent
1601ad14e3
commit
95bcac9d9b
1 changed files with 2 additions and 2 deletions
|
|
@ -129,8 +129,8 @@ class TextBasedChannel {
|
|||
fetchMessage(messageID) {
|
||||
if (!this.client.user.bot) {
|
||||
return this.fetchMessages({ limit: 1, around: messageID }).then(messages => {
|
||||
const msg = messages.first();
|
||||
if (msg.id !== messageID) throw new Error('Message not found.');
|
||||
const msg = messages.get(messageID);
|
||||
if (!msg) throw new Error('Message not found.');
|
||||
return msg;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue