fedimbed: cursed quote tweet resolving
This commit is contained in:
		
							parent
							
								
									c01777e2b5
								
							
						
					
					
						commit
						ecebdaa361
					
				
					 1 changed files with 25 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1421,6 +1421,17 @@ async function processUrl(msg, url, spoiler = false, command = false) {
 | 
			
		|||
  content = content ?? "";
 | 
			
		||||
  cw = cw ?? "";
 | 
			
		||||
 | 
			
		||||
  let quoteRes;
 | 
			
		||||
  if (platformName == "Nitter") {
 | 
			
		||||
    const quote = content.match(/<blockquote><b>↘ <a href="([^"]+?)">/);
 | 
			
		||||
    if (quote?.[1]) {
 | 
			
		||||
      const quoteUrl = quote[1];
 | 
			
		||||
      content = content.replace(/<blockquote><b>↘ <a href="[^"]+?">.+?<\/blockquote>/, "");
 | 
			
		||||
 | 
			
		||||
      quoteRes = await processUrl(msg, quoteUrl, spoiler, command);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  content = htmlToMarkdown(content);
 | 
			
		||||
 | 
			
		||||
  for (const emote of emotes) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1473,6 +1484,12 @@ async function processUrl(msg, url, spoiler = false, command = false) {
 | 
			
		|||
  if (platformName == "Nitter") {
 | 
			
		||||
    const newHandle = author.handle.split("@")[0];
 | 
			
		||||
    user = `${author.name} (@${newHandle})`;
 | 
			
		||||
 | 
			
		||||
    const contextHandle = context.match(/\(([^@]+?@.+?)\)/)?.[1];
 | 
			
		||||
    if (contextHandle) {
 | 
			
		||||
      const newContextHandle = "@" + contextHandle.split("@")[0];
 | 
			
		||||
      context = context.replace(contextHandle, newContextHandle);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const baseEmbed = {
 | 
			
		||||
| 
						 | 
				
			
			@ -1762,6 +1779,14 @@ async function processUrl(msg, url, spoiler = false, command = false) {
 | 
			
		|||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (quoteRes) {
 | 
			
		||||
    if (!sendWait && quoteRes.sendWait) sendWait = true;
 | 
			
		||||
    files.push(...quoteRes.response.attachments);
 | 
			
		||||
    const quoteEmbed = quoteRes.embeds[0];
 | 
			
		||||
    quoteEmbed.author = {name: "Quoted Post", icon_url: "https://cdn.discordapp.com/emojis/1308640087759654922.png"};
 | 
			
		||||
    embeds.push(quoteEmbed);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return {
 | 
			
		||||
    response: {
 | 
			
		||||
      content:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue