1. Fix message.mentions

This commit is contained in:
March 7th 2022-03-30 18:09:23 +07:00
parent 4e870872f5
commit ab113790e3
2 changed files with 28 additions and 34 deletions

View File

@ -12,7 +12,7 @@ const {
function parseResponse(res) {
if (res.headers.get('content-type').startsWith('application/json')) return res.json();
return res.buffer();
return res.arrayBuffer(); // Cre: TheDevYellowy
}
function getAPIOffset(serverDate) {

View File

@ -225,7 +225,6 @@ class Message extends Base {
* All valid mentions that the message contains
* @type {MessageMentions}
*/
if (!data.mentions)
this.mentions = new Mentions(
this,
data.mentions,
@ -234,10 +233,6 @@ class Message extends Base {
data.mention_channels,
data.referenced_message?.author,
);
else
data.mentions instanceof Mentions
? (this.mentions = data.mentions)
: (this.mentions = null);
} else {
this.mentions = new Mentions(
this,
@ -491,8 +486,7 @@ class Message extends Base {
* @readonly
*/
get url() {
return `https://discord.com/channels/${this.guildId ?? '@me'}/${
this.channelId
return `https://discord.com/channels/${this.guildId ?? '@me'}/${this.channelId
}/${this.id}`;
}
@ -1097,7 +1091,7 @@ class Message extends Base {
*/
async contextMenu(botID, commandName) {
if (!botID) throw new Error('Bot ID is required');
const user = await this.client.users.fetch(botID).catch(() => {});
const user = await this.client.users.fetch(botID).catch(() => { });
if (!user || !user.bot || !user.applications)
throw new Error(
'BotID is not a bot or does not have an application slash command',