mirror of
https://github.com/danbulant/discord.js
synced 2026-06-21 15:51:48 +00:00
Webpack build for branch master: 64ce829ab2
This commit is contained in:
parent
0f59dde4e0
commit
944f5f0852
2 changed files with 10 additions and 2 deletions
|
|
@ -3751,7 +3751,8 @@ class TextBasedChannel {
|
|||
|
||||
/**
|
||||
* Gets a single message from this channel, regardless of it being cached or not.
|
||||
* <warn>This is only available when using a bot account.</warn>
|
||||
* Since the single message fetching endpoint is reserved for bot accounts, this abstracts
|
||||
* {@link #fetchMessages} to obtain the single message when using a user account.
|
||||
* @param {Snowflake} messageID ID of the message to get
|
||||
* @returns {Promise<Message>}
|
||||
* @example
|
||||
|
|
@ -3761,6 +3762,13 @@ class TextBasedChannel {
|
|||
* .catch(console.error);
|
||||
*/
|
||||
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.');
|
||||
return msg;
|
||||
});
|
||||
}
|
||||
return this.client.rest.methods.getChannelMessage(this, messageID).then(data => {
|
||||
const msg = data instanceof Message ? data : new Message(this, data, this.client);
|
||||
this._cacheMessage(msg);
|
||||
|
|
|
|||
2
discord.master.min.js
vendored
2
discord.master.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue