diff --git a/freemoji/index.js b/freemoji/index.js index 6e61baa..4b2f92b 100644 --- a/freemoji/index.js +++ b/freemoji/index.js @@ -1,3 +1,3 @@ -(function(s,t,a,r,u,f,y,S){"use strict";const j=a.findByProps("canUseEmojisEverywhere");var h=[r.instead("canUseEmojisEverywhere",j,function(){return!0}),r.instead("canUseAnimatedEmojis",j,function(){return!0})];const{getCustomEmojiById:E}=a.findByStoreName("EmojiStore"),{getGuildId:v}=a.findByStoreName("SelectedGuildStore"),p=//i;function b(e,n){const o=e.matchAll(//gi),m=[];for(const i of o){const l=E(i[2]);if(l.guildId!=v()||l.animated){e=e.replace(i[0],"");var d="webp";l.animated&&(d="gif"),t.storage.hyperlink===!0?m.push(`[${i[1]}](https://cdn.discordapp.com/emojis/${i[2]}.${d}?size=${n}&quality=lossless&name=${i[1]})`):m.push(`https://cdn.discordapp.com/emojis/${i[2]}.${d}?size=${n}`)}}return{newContent:e.trim(),extractedEmojis:m}}function g(e){if(!e.content.match(p))return;const{newContent:n,extractedEmojis:o}=b(e.content,t.storage.emojiSize);e.content=n,o.length>0&&(t.storage.hyperlink===!0?e.content+=" "+o.join(" "):e.content+=` +(function(s,e,r,i,j,c,h,g){"use strict";const y=r.findByProps("canUseEmojisEverywhere");var E=[i.instead("canUseEmojisEverywhere",y,function(){return!0}),i.instead("canUseAnimatedEmojis",y,function(){return!0})];const{getCustomEmojiById:b}=r.findByStoreName("EmojiStore"),{getGuildId:R}=r.findByStoreName("SelectedGuildStore"),$=//i;function w(t,a){const o=t.matchAll(//gi),l=[];for(const n of o){const u=b(n[2]);if(u.guildId!=R()||u.animated){t=t.replace(n[0],"");var f="webp";u.animated&&(f="gif"),e.storage.hyperlink===!0?l.push(`[${n[1]}](https://cdn.discordapp.com/emojis/${n[2]}.${f}?size=${a}&quality=lossless&name=${n[1]})`):l.push(`https://cdn.discordapp.com/emojis/${n[2]}.${f}?size=${a}`)}}return{newContent:t.trim(),extractedEmojis:l}}function v(t){if(!t.content.match($)&&(!e.storage.haveNitro||!e.storage.forceMoji))return;const{newContent:a,extractedEmojis:o}=w(t.content,e.storage.emojiSize);t.content=a,o.length>0&&(e.storage.hyperlink===!0?t.content+=" "+o.join(" "):t.content+=` `+o.join(` -`)),e.invalidEmojis=[]}const w=a.findByProps("sendMessage","receiveMessage"),z=a.findByProps("uploadLocalFiles");var R=[r.before("sendMessage",w,function(e){return g(e[1])}),r.before("uploadLocalFiles",z,function(e){return g(e[0].parsedMessage)})];const{FormSection:c,FormRadioRow:$,FormSwitchRow:k}=f.Forms,B={Tiny:16,Small:32,Medium:48,Large:64,Huge:96,Jumbo:128},F="https://cdn.discordapp.com/emojis/926602689213767680.webp";function I(){return y.useProxy(t.storage),React.createElement(u.ReactNative.ScrollView,{style:{flex:1},contentContainerStyle:{paddingBottom:38}},React.createElement(c,{title:"Settings",titleStyleType:"no_border"},React.createElement(k,{label:"Hyperlink emoji",subLabel:"Hyperlinks emoji link to be less distractive",leading:React.createElement(f.Forms.FormIcon,{source:S.getAssetIDByName("ic_link")}),value:t.storage.hyperlink,onValueChange:function(){t.storage.hyperlink=!t.storage.hyperlink},note:""})),React.createElement(c,{title:"Emoji Size"},Object.entries(B).map(function(e){let[n,o]=e;return React.createElement($,{label:n,subLabel:o,selected:t.storage.emojiSize===o,onPress:function(){t.storage.emojiSize=o}})})),React.createElement(c,{title:"Preview"},React.createElement(u.ReactNative.Image,{source:{uri:`${F}?size=${t.storage.emojiSize}`,width:t.storage.emojiSize,height:t.storage.emojiSize}})))}t.storage.emojiSize??=48,t.storage.hyperlink??=!0,typeof t.storage.emojiSize=="string"&&(t.storage.emojiSize=parseInt(t.storage.emojiSize));const P=[...h,...R],C=function(){return P.forEach(function(e){return e()})};return s.onUnload=C,s.settings=I,s})({},vendetta.plugin,vendetta.metro,vendetta.patcher,vendetta.metro.common,vendetta.ui.components,vendetta.storage,vendetta.ui.assets); +`)),t.invalidEmojis=[]}const z=r.findByProps("sendMessage","receiveMessage"),F=r.findByProps("uploadLocalFiles");var k=[i.before("sendMessage",z,function(t){return v(t[1])}),i.before("uploadLocalFiles",F,function(t){return v(t[0].parsedMessage)})];const{FormSection:m,FormRadioRow:B,FormSwitchRow:S}=c.Forms,M={Tiny:16,Small:32,Medium:48,Large:64,Huge:96,Jumbo:128},p="https://cdn.discordapp.com/emojis/926602689213767680.webp";function I(){return h.useProxy(e.storage),React.createElement(j.ReactNative.ScrollView,{style:{flex:1},contentContainerStyle:{paddingBottom:38}},React.createElement(m,{title:"Settings",titleStyleType:"no_border"},React.createElement(S,{label:"Hyperlink emoji",subLabel:"Hyperlinks emoji link to be less distractive",leading:React.createElement(c.Forms.FormIcon,{source:g.getAssetIDByName("ic_link")}),value:e.storage.hyperlink,onValueChange:function(){e.storage.hyperlink=!e.storage.hyperlink},note:""}),React.createElement(S,{label:"Force Freemoji",subLabel:"Explicitly force Freemoji even if you have nitro (useful for testing)",leading:React.createElement(c.Forms.FormIcon,{source:g.getAssetIDByName("img_nitro_emojis")}),value:e.storage.forceMoji,onValueChange:function(){e.storage.forceMoji=!e.storage.forceMoji},note:""})),React.createElement(m,{title:"Emoji Size"},Object.entries(M).map(function(t){let[a,o]=t;return React.createElement(B,{label:a,subLabel:o,selected:e.storage.emojiSize===o,onPress:function(){e.storage.emojiSize=o}})})),React.createElement(m,{title:"Preview"},React.createElement(j.ReactNative.Image,{source:{uri:`${p}?size=${e.storage.emojiSize}`,width:e.storage.emojiSize,height:e.storage.emojiSize}})))}var d;e.storage.emojiSize??=48,e.storage.hyperlink??=!0,e.storage.haveNitro??=((d=r.findByStoreName("UserStore").getCurrentUser())===null||d===void 0?void 0:d.purchasedFlags)!=0,e.storage.forceMoji??=!1,typeof e.storage.emojiSize=="string"&&(e.storage.emojiSize=parseInt(e.storage.emojiSize));const N=[...E,...k],C=function(){return N.forEach(function(t){return t()})};return s.onUnload=C,s.settings=I,s})({},vendetta.plugin,vendetta.metro,vendetta.patcher,vendetta.metro.common,vendetta.ui.components,vendetta.storage,vendetta.ui.assets); diff --git a/freemoji/manifest.json b/freemoji/manifest.json index fb27af1..0592e9e 100644 --- a/freemoji/manifest.json +++ b/freemoji/manifest.json @@ -1 +1 @@ -{"name":"Freemoji","description":"Allows you to use Nitro emoji without Nitro.","authors":[{"name":"maisy","id":"257109471589957632"},{"name":"Rico040","id":"619474349845643275"}],"main":"index.js","vendetta":{"icon":"img_nitro_emojis"},"hash":"6f77866d965a48ada13dcb35f012adcc13b37a17fcacb5de6a86e0d3551f8533"} \ No newline at end of file +{"name":"Freemoji","description":"Allows you to use Nitro emoji without Nitro.","authors":[{"name":"maisy","id":"257109471589957632"},{"name":"Rico040","id":"619474349845643275"}],"main":"index.js","vendetta":{"icon":"img_nitro_emojis"},"hash":"6c56c51604fd23248157d361102ed3055e3624668783603520b5707bcd7b1fe3"} \ No newline at end of file