Update before publish to npm

Dev version
This commit is contained in:
March 7th
2022-04-01 20:09:32 +07:00
parent d233d0e83e
commit 50516bf89d
6 changed files with 60 additions and 19 deletions

View File

@@ -127,7 +127,7 @@ class MessagePayload {
const isInteraction = this.isInteraction;
const isWebhook = this.isWebhook;
const content = this.makeContent();
let content = this.makeContent();
const tts = Boolean(this.options.tts);
let nonce;
@@ -197,11 +197,22 @@ class MessagePayload {
let webembeds = this.options.embeds.filter(e => e instanceof WebEmbed);
this.options.embeds = this.options.embeds.filter(e => !(e instanceof WebEmbed));
if (webembeds.length > 0) {
// add hidden embed link
content += `\n${WebEmbed.hiddenEmbed} \n`;
}
while (webembeds.length) {
const embed = webembeds.shift();
const data = await embed.toMessage();
content +=`\n${data}`
}
// Check content
if (content.length > 2000) {
console.warn(`[WARN] Content is longer than 2000 characters.`);
}
if (content.length > 4000) { // Max length if user has nitro boost
throw new RangeError('MESSAGE_EMBED_LINK_LENGTH');
}
}
this.data = {