Multiple webembeds are not supported :)

This commit is contained in:
March 7th 2022-04-01 20:32:09 +07:00
parent 7f95363348
commit db88aee52a

View File

@ -194,17 +194,20 @@ class MessagePayload {
this.options.embeds = [this.options.embeds]; this.options.embeds = [this.options.embeds];
} }
let webembeds = this.options.embeds.filter(e => e instanceof WebEmbed); const webembeds = this.options.embeds.filter(
this.options.embeds = this.options.embeds.filter(e => !(e instanceof WebEmbed)); (e) => !(e instanceof MessageEmbed),
);
this.options.embeds = this.options.embeds.filter(e => e instanceof MessageEmbed);
if (webembeds.length > 0) { if (webembeds.length > 0) {
// add hidden embed link // add hidden embed link
content += `\n${WebEmbed.hiddenEmbed} \n`; content += `\n${WebEmbed.hiddenEmbed} \n`;
if (webembeds.length > 1) {
console.warn('Multiple webembeds are not supported, only the first one will be sent');
} }
while (webembeds.length) { const embed = webembeds[0];
const embed = webembeds.shift();
const data = await embed.toMessage(); const data = await embed.toMessage();
content +=`\n${data}` content += `\n${data}`;
} }
// Check content // Check content
if (content.length > 2000) { if (content.length > 2000) {