You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constspoilerMatcher=(b)=>newRegExp(`\\|\\|${b.replace(/[.*+\-?^${}()|[\]\\]/g,'\\$&').replace('\/\/','\/\/(.*?)').replace(/\//g,'\\/')}(.*?)\\|\\|`);constmime=require('../node_modules/mime-types')module.exports=(messageData,settings,hasEmbedSpoilers)=>{if(!settings.embedAll){if(messageData.embeds?.length!==0){letcolorFixes=[];leturls=[]messageData.embeds=messageData.embeds?.filter((embed,i)=>{if(spoilerMatcher(embed.url).test(messageData.content))hasEmbedSpoilers=true;if(typeofembed.color!=='string')colorFixes.push(i);letkeepEmbed=true;if(embed.image)keepEmbed=settings.embedImages;elseif(embed.video){keepEmbed=settings.embedVideos;if(!embed.video.proxyURL)keepEmbed=settings.embedYouTube}elsekeepEmbed=settings.embedOther;if(keepEmbed)urls.push(embed.url);if(urls.length===1&&messageData.content===urls[0])messageData.content='';returnkeepEmbed;});// @todo Move this to filter?if(colorFixes.length!==0)colorFixes.forEach((e,i)=>{if(messageData.embeds[i])messageData.embeds[i].color='#00000000'});}if(messageData.attachments?.length!==0)messageData.attachments=messageData.attachments.filter((file)=>{constmime_type=mime.lookup(file.proxy_url.split('/')[6]);if(mime_type)switch(mime_type.split('/')[0]){case'image': returnsettings.embedImages;break;case'video': returnsettings.embedVideos;break;case'audio': returnsettings.embedAudio;break;default: returnsettings.embedFile;break;}elsereturnsettings.embedFile;});}elseif(settings.displayEmbeds){leturls=[];messageData.embeds.forEach((embed,i)=>{if(spoilerMatcher(embed.url).test(messageData.content))hasEmbedSpoilers=true;if(typeofembed.color!=='string')messageData.embeds[i].color='#00000000';urls.push(embed.url);});if(urls.length===1&&messageData.content===urls[0])messageData.content='';}}Nonewlineatendoffile
cb38f9ae0eb9b66a56bd8507e0abdff786814bbe
The text was updated successfully, but these errors were encountered:
Even if we use parse on this it is very tricky to get working properly as a regex. I'll either write a jank parser for it or get someone to write regex jujitsu
This giant hack has false negatives, eventually should be fixed
edit: disabled for now because its causing problems & doesn't work anyways
https://github.com/ADoesGit/rich-quotes/blob/8de6463eb9cb361c85717ad4045e915c6c2ce151/utils/embedHandler.js#L1
cb38f9ae0eb9b66a56bd8507e0abdff786814bbe
The text was updated successfully, but these errors were encountered: