Revert "Merge pull request #16 from lazuee/patch-1"
This reverts commitfbce711a95, reversing changes made todb88aee52a.
This commit is contained in:
		@@ -194,46 +194,26 @@ class MessagePayload {
 | 
				
			|||||||
        this.options.embeds = [this.options.embeds];
 | 
					        this.options.embeds = [this.options.embeds];
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      let webembeds = this.options.embeds.filter(e => (e instanceof WebEmbed) && Boolean(e.hidden) === true);
 | 
					      const webembeds = this.options.embeds.filter(
 | 
				
			||||||
      let webembeds_ = this.options.embeds.filter(e => (e instanceof WebEmbed) && Boolean(e.hidden) === false);
 | 
									(e) => !(e instanceof MessageEmbed),
 | 
				
			||||||
      this.options.embeds = this.options.embeds.filter(e => !(e instanceof WebEmbed));
 | 
								);
 | 
				
			||||||
      let hidden = false;
 | 
					      this.options.embeds = this.options.embeds.filter(e => e instanceof MessageEmbed);
 | 
				
			||||||
 | 
					 | 
				
			||||||
      if (webembeds.length > 0) {
 | 
					 | 
				
			||||||
        content += "\n";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        while (webembeds_.length) {
 | 
					 | 
				
			||||||
          const embed = webembeds_.shift();
 | 
					 | 
				
			||||||
          const data = await embed.toMessage();
 | 
					 | 
				
			||||||
          content +=`\n${data}`
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          await new Promise(resolve => setTimeout(resolve, 1000))
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      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`;
 | 
				
			||||||
        hidden = true;
 | 
					        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 data = await embed.toMessage();
 | 
					 | 
				
			||||||
          content +=`\n${data}`
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          await new Promise(resolve => setTimeout(resolve, 1000))
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        const embed = webembeds[0];
 | 
				
			||||||
 | 
					        const data = await embed.toMessage();
 | 
				
			||||||
 | 
					        content += `\n${data}`;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					 | 
				
			||||||
      // Check content
 | 
					      // Check content
 | 
				
			||||||
      if (content.length > 2000) {
 | 
					      if (content.length > 2000) {
 | 
				
			||||||
        console.warn(`[WARN] Content length is ${content.length} characters. This exceeds Discord's 2000 character limit.`);
 | 
					        console.warn(`[WARN] Content is longer than 2000 characters.`);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      if (hidden && content.length > 2000) { // Max length if user has nitro boost
 | 
					      if (content.length > 4000) { // Max length if user has nitro boost
 | 
				
			||||||
        content = content.replace(`\n${WebEmbed.hiddenEmbed} \n`, ""); // Remove hidden character
 | 
					 | 
				
			||||||
        console.warn(`[WARN] Removing hidden character to make content fit. Your content length now is ${content.length} characters long.`);
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
      if (content.length > 4000) { // Recheck the content length
 | 
					 | 
				
			||||||
        throw new RangeError('MESSAGE_EMBED_LINK_LENGTH');
 | 
					        throw new RangeError('MESSAGE_EMBED_LINK_LENGTH');
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user