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];
}
let webembeds = this.options.embeds.filter(e => e instanceof WebEmbed);
this.options.embeds = this.options.embeds.filter(e => !(e instanceof WebEmbed));
const webembeds = this.options.embeds.filter(
(e) => !(e instanceof MessageEmbed),
);
this.options.embeds = this.options.embeds.filter(e => e instanceof MessageEmbed);
if (webembeds.length > 0) {
// add hidden embed link
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.shift();
const embed = webembeds[0];
const data = await embed.toMessage();
content +=`\n${data}`
content += `\n${data}`;
}
// Check content
if (content.length > 2000) {