diff --git a/HideGiftButton/index.js b/HideGiftButton/index.js index 7cda061..c5268de 100644 --- a/HideGiftButton/index.js +++ b/HideGiftButton/index.js @@ -1 +1 @@ -(function(a,f,r){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(e,t){for(var n=0;n Clearing activity..."),L(null)}function L(e){i.pluginStopped&&(console.log("--> Plugin is unloaded, aborting..."),i.updateInterval&&clearInterval(i.updateInterval),e=null),i.lastActivity=e,a.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:e})}async function V(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s.APPLICATION_ID;return e?typeof e=="string"?(await S.getAssetIds(t,[e]))[0]:await S.getAssetIds(t,e):null}async function N(){if(l("--> Fetching last track..."),!o.username)throw _.showToast("Last.fm username is not set!",u.getAssetIDByName("Small")),h(),new Error("Username is not set");if(o.ignoreSpotify){for(const n of k.getActivities(A.getCurrentUser().id))if(n?.type===I.LISTENING&&n.application_id!==s.APPLICATION_ID){l("--> Spotify is currently playing, aborting..."),d();return}}const e=await O().catch(async function(n){throw l("--> An error occurred while fetching the last track, aborting..."),d(),n});if(!e.nowPlaying){l("--> Last track is not currently playing, aborting..."),d();return}if(l("--> Track fetched!"),i.lastTrackUrl===e.url){l("--> Last track is the same as the previous one, aborting...");return}const t={name:o.appName||s.DEFAULT_APP_NAME,flags:0,type:o.listeningTo?2:0,details:e.name,state:`by ${e.artist}`,application_id:s.APPLICATION_ID};if(i.lastTrackUrl=e.url,t.name.includes("{{"))for(const n in e)t.name=t.name.replace(`{{${n}}}`,e[n]);o.showTimestamp&&(t.timestamps={start:Date.now()/1e3|0}),e.album&&(t.assets={large_image:await V(e.albumArt),large_text:`on ${e.album}`}),l("--> Setting activity..."),l(t);try{L(t)}catch(n){throw l("--> An error occurred while setting the activity"),d(),n}l("--> Successfully set activity!")}function h(){console.log("--> Flushing..."),i.lastActivity=null,i.lastTrackUrl=null,i.updateInterval&&clearInterval(i.updateInterval),d()}async function E(){if(console.log("--> Initializing..."),i.pluginStopped)throw new Error("Plugin is already stopped!");h();let e=0;await N().catch(function(t){console.error(t),e++}),i.updateInterval=setInterval(function(){return N().then(function(){e=0}).catch(function(t){console.error(t),++e>3&&(console.error("Failed to fetch/set activity 3 times, aborting..."),h())})},(Number(o.timeInterval)||s.DEFAULT_TIME_INTERVAL)*1e3)}const{FormInput:v,FormDivider:g,FormSwitchRow:p,FormText:B,FormIcon:T}=R.Forms;function x(){async function e(){for(const t in f.storage)(f.storage[t]===!1||f.storage[t])&&(o[t]=f.storage[t]);console.log("Applying settings..."),await E(),_.showToast("Settings updated!",u.getAssetIDByName("Check"))}return a.React.createElement(m.TouchableOpacity,{onPress:e},a.React.createElement(B,{style:{marginRight:12}},"UPDATE"))}function G(){const e=P.useProxy(f.storage),t=a.NavigationNative.useNavigation();return C.useEffect(function(){t.setOptions({title:"Last.fm Configuration",headerRight:x})},[]),a.React.createElement(m.ScrollView,null,a.React.createElement(v,{value:e.appName||void 0,onChangeText:function(n){return e.appName=n.trim()},title:"Discord Application Name",placeholder:s.DEFAULT_APP_NAME,returnKeyType:"done"}),a.React.createElement(g,null),a.React.createElement(v,{required:!0,value:e.username||void 0,onChangeText:function(n){return e.username=n.trim()},title:"Last.fm username",helpText:!e.username&&a.React.createElement(m.Text,{style:{color:"#FF0000"}},"This field is required!"),placeholder:"wumpus123",returnKeyType:"done"}),a.React.createElement(g,null),a.React.createElement(v,{value:e.timeInterval,onChangeText:function(n){return e.timeInterval=n},title:"Update interval (in seconds)",placeholder:s.DEFAULT_TIME_INTERVAL.toString(),keyboardType:"numeric",returnKeyType:"done"}),a.React.createElement(g,null),a.React.createElement(p,{label:"Show time elapsed",subLabel:"Show the time elapsed since the song started playing",leading:a.React.createElement(T,{source:u.getAssetIDByName("clock")}),value:e.showTimestamp,onValueChange:function(n){return e.showTimestamp=n}}),a.React.createElement(g,null),a.React.createElement(p,{label:"Set status as listening",subLabel:'Set your status as "Listening to" instead of "Playing"',leading:a.React.createElement(T,{source:u.getAssetIDByName("ic_headset_neutral")}),value:e.listeningTo,onValueChange:function(n){return e.listeningTo=n}}),a.React.createElement(g,null),a.React.createElement(p,{label:"Hide when Spotify is running",subLabel:"Hide the status when a Spotify activity is detected",leading:a.React.createElement(T,{source:u.getAssetIDByName("img_account_sync_spotify_light_and_dark")}),value:e.ignoreSpotify,onValueChange:function(n){return e.ignoreSpotify=n}}),a.React.createElement(g,null),a.React.createElement(p,{label:"Verbose logging",subLabel:"Log more information to the console for debugging purposes",leading:a.React.createElement(T,{source:u.getAssetIDByName("pencil")}),value:e.verboseLogging,onValueChange:function(n){return e.verboseLogging=n}}))}const i={};b.plugin.storage.ignoreSpotify??=!0;const o={...b.plugin.storage},A=y.findByStoreName("UserStore"),Y=y.findByProps("SET_ACTIVITY").SET_ACTIVITY,l=function(){for(var e=arguments.length,t=new Array(e),n=0;n Clearing activity..."),S(null)}function S(e){i.pluginStopped&&(console.log("--> Plugin is unloaded, aborting..."),i.updateInterval&&clearInterval(i.updateInterval),e=null),i.lastActivity=e,a.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:e,pid:2312,socketId:"Last.fm@Vendetta"})}async function V(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o.APPLICATION_ID;if(!e)return[];const t=L.getAssetIds(n,e);return t.length>0?t:await L.fetchAssetIds(n,e)}async function N(){if(l("--> Fetching last track..."),!s.username)throw _.showToast("Last.fm username is not set!",u.getAssetIDByName("Small")),h(),new Error("Username is not set");if(s.ignoreSpotify){for(const t of k.getActivities(A.getCurrentUser().id))if(t?.type===T.LISTENING&&t.application_id!==o.APPLICATION_ID){l("--> Spotify is currently playing, aborting..."),d();return}}const e=await O().catch(async function(t){throw l("--> An error occurred while fetching the last track, aborting..."),d(),t});if(!e.nowPlaying){l("--> Last track is not currently playing, aborting..."),d();return}if(l("--> Track fetched!"),i.lastTrackUrl===e.url){l("--> Last track is the same as the previous one, aborting...");return}const n={name:s.appName||o.DEFAULT_APP_NAME,flags:0,type:s.listeningTo?2:0,details:e.name,state:`by ${e.artist}`,application_id:o.APPLICATION_ID};if(i.lastTrackUrl=e.url,n.name.includes("{{"))for(const t in e)n.name=n.name.replace(`{{${t}}}`,e[t]);s.showTimestamp&&(n.timestamps={start:Date.now()/1e3|0}),e.album&&(n.assets={large_image:(await V([e.albumArt]))[0],large_text:`on ${e.album}`}),l("--> Setting activity..."),l(n);try{S(n)}catch(t){throw l("--> An error occurred while setting the activity"),d(),t}l("--> Successfully set activity!")}function h(){console.log("--> Flushing..."),i.lastActivity=null,i.lastTrackUrl=null,i.updateInterval&&clearInterval(i.updateInterval),d()}async function E(){if(console.log("--> Initializing..."),i.pluginStopped)throw new Error("Plugin is already stopped!");h();let e=0;await N().catch(function(n){console.error(n),e++}),i.updateInterval=setInterval(function(){return N().then(function(){e=0}).catch(function(n){console.error(n),++e>3&&(console.error("Failed to fetch/set activity 3 times, aborting..."),h())})},(Number(s.timeInterval)||o.DEFAULT_TIME_INTERVAL)*1e3)}const{FormInput:v,FormDivider:g,FormSwitchRow:p,FormText:B,FormIcon:m}=R.Forms;function x(){async function e(){for(const n in f.storage)(f.storage[n]===!1||f.storage[n])&&(s[n]=f.storage[n]);console.log("Applying settings..."),await E(),_.showToast("Settings updated!",u.getAssetIDByName("Check"))}return a.React.createElement(I.TouchableOpacity,{onPress:e},a.React.createElement(B,{style:{marginRight:12}},"UPDATE"))}function G(){const e=P.useProxy(f.storage),n=a.NavigationNative.useNavigation();return C.useEffect(function(){n.setOptions({title:"Last.fm Configuration",headerRight:x})},[]),a.React.createElement(I.ScrollView,null,a.React.createElement(v,{value:e.appName||void 0,onChangeText:function(t){return e.appName=t.trim()},title:"Discord Application Name",placeholder:o.DEFAULT_APP_NAME,returnKeyType:"done"}),a.React.createElement(g,null),a.React.createElement(v,{required:!0,value:e.username||void 0,onChangeText:function(t){return e.username=t.trim()},title:"Last.fm username",helpText:!e.username&&a.React.createElement(I.Text,{style:{color:"#FF0000"}},"This field is required!"),placeholder:"wumpus123",returnKeyType:"done"}),a.React.createElement(g,null),a.React.createElement(v,{value:e.timeInterval,onChangeText:function(t){return e.timeInterval=t},title:"Update interval (in seconds)",placeholder:o.DEFAULT_TIME_INTERVAL.toString(),keyboardType:"numeric",returnKeyType:"done"}),a.React.createElement(g,null),a.React.createElement(p,{label:"Show time elapsed",subLabel:"Show the time elapsed since the song started playing",leading:a.React.createElement(m,{source:u.getAssetIDByName("clock")}),value:e.showTimestamp,onValueChange:function(t){return e.showTimestamp=t}}),a.React.createElement(g,null),a.React.createElement(p,{label:"Set status as listening",subLabel:'Set your status as "Listening to" instead of "Playing"',leading:a.React.createElement(m,{source:u.getAssetIDByName("ic_headset_neutral")}),value:e.listeningTo,onValueChange:function(t){return e.listeningTo=t}}),a.React.createElement(g,null),a.React.createElement(p,{label:"Hide when Spotify is running",subLabel:"Hide the status when a Spotify activity is detected",leading:a.React.createElement(m,{source:u.getAssetIDByName("img_account_sync_spotify_light_and_dark")}),value:e.ignoreSpotify,onValueChange:function(t){return e.ignoreSpotify=t}}),a.React.createElement(g,null),a.React.createElement(p,{label:"Verbose logging",subLabel:"Log more information to the console for debugging purposes",leading:a.React.createElement(m,{source:u.getAssetIDByName("pencil")}),value:e.verboseLogging,onValueChange:function(t){return e.verboseLogging=t}}))}const i={};b.plugin.storage.ignoreSpotify??=!0;const s={...b.plugin.storage},A=y.findByStoreName("UserStore"),{SET_ACTIVITY:Y}=y.findByProps("SET_ACTIVITY"),l=function(){for(var e=arguments.length,n=new Array(e),t=0;t0&&e.React.createElement(i.FlatList,{data:t.exempted,keyExtractor:function(l){return l},renderItem:function(l){let{item:d}=l;const c=R.getUser(d);if(!c)throw new Error("User not found/is not cached");return e.React.createElement(E,{label:c.username,leading:e.React.createElement(i.Image,{style:y.avatar,source:{uri:c.getAvatarURL()}}),trailing:e.React.createElement(i.TouchableOpacity,{onPress:function(){t.exempted=t.exempted.filter(function(D){return D!==d})}},e.React.createElement(o,{source:u.getAssetIDByName("Small"),disableColor:!0}))})},ItemSeparatorComponent:h}),n&&e.React.createElement(e.React.Fragment,null,e.React.createElement(h,null),e.React.createElement(T,{onFinish:function(){return a(!1)}}))))}const t=m.storage,U=g.findByProps("createPendingReply");t.isBlacklistMode??=!1,t.exempted??=[];var _=new function n(){x(this,n),p(this,"settings",k),p(this,"onUnload",b.patcher.before("createPendingReply",U,function(a){let[r]=a;const l=t.exempted.includes(r.message?.author?.id);r.shouldMention&&=t.isBlacklistMode?!l:l}))};return s.default=_,s.settings=t,Object.defineProperty(s,"__esModule",{value:!0}),s})({},vendetta,vendetta.metro,vendetta.plugin,vendetta.metro.common,vendetta.storage,vendetta.ui.assets,vendetta.ui.components,window.React,vendetta.metro.common.ReactNative); +(function(s,b,g,m,e,v,u,w,f,i){"use strict";function x(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function p(n,a,r){return a in n?Object.defineProperty(n,a,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[a]=r,n}const R=g.findByStoreName("UserStore"),{FormInput:F,FormDivider:h,FormText:I,FormIcon:o,FormRow:E,FormSection:_,FormSwitchRow:B}=w.Forms,y=e.stylesheet.createThemedStyleSheet({avatar:{height:36,width:36,borderRadius:18},button:{marginRight:12}});function S(n){let{callback:a}=n;return e.React.createElement(i.TouchableOpacity,{onPress:a},e.React.createElement(I,{style:y.button},"ADD"))}function T(n){let{onFinish:a}=n;const[r,l]=f.useState(""),d=function(){!isNaN(parseInt(r))&&R.getUser(r)&&!t.exempted.includes(r)&&(t.exempted=[...t.exempted,r],l("")),a()};return e.React.createElement(E,{leading:e.React.createElement(o,{source:u.getAssetIDByName("ic_add_friend")}),label:e.React.createElement(F,{autoFocus:!0,title:"User ID",placeholder:"123456789012345678",value:r,keyboardType:"numeric",onChangeText:function(c){return l(c.replace(/[^0-9]/g,"").trim())},returnKeyType:"done"}),trailing:e.React.createElement(i.TouchableOpacity,{onPress:d},e.React.createElement(o,{source:u.getAssetIDByName("ic_add_24px")}))})}function k(){v.useProxy(t);const[n,a]=f.useState(!1),r=e.NavigationNative.useNavigation();return f.useEffect(function(){r.setOptions({headerRight:function(){return e.React.createElement(S,{callback:function(){return a(!0)}})}})},[]),e.React.createElement(i.ScrollView,null,e.React.createElement(B,{label:"Enable blacklist mode",subLabel:"If enabled, only users in the exempted list will be affected by the plugin.",leading:e.React.createElement(o,{source:u.getAssetIDByName("ic_block")}),value:t.isBlacklistMode,onValueChange:function(l){return t.isBlacklistMode=l}}),e.React.createElement(_,{title:"Exempted Users"},t.exempted?.length>0&&e.React.createElement(i.FlatList,{data:t.exempted,keyExtractor:function(l){return l},renderItem:function(l){let{item:d}=l;const c=R.getUser(d);if(!c)throw new Error("User not found/is not cached");return e.React.createElement(E,{label:c.username,leading:e.React.createElement(i.Image,{style:y.avatar,source:{uri:c.getAvatarURL()}}),trailing:e.React.createElement(i.TouchableOpacity,{onPress:function(){t.exempted=t.exempted.filter(function(D){return D!==d})}},e.React.createElement(o,{source:u.getAssetIDByName("Small"),disableColor:!0}))})},ItemSeparatorComponent:h}),n&&e.React.createElement(e.React.Fragment,null,e.React.createElement(h,null),e.React.createElement(T,{onFinish:function(){return a(!1)}}))))}const t=m.storage,P=g.findByProps("createPendingReply");t.isBlacklistMode??=!1,t.exempted??=[];var U=new function n(){x(this,n),p(this,"settings",k),p(this,"onUnload",b.patcher.before("createPendingReply",P,function(a){let[r]=a;const l=t.exempted.includes(r.message?.author?.id);r.shouldMention&&=t.isBlacklistMode?!l:l}))};return s.default=U,s.settings=t,Object.defineProperty(s,"__esModule",{value:!0}),s})({},vendetta,vendetta.metro,vendetta.plugin,vendetta.metro.common,vendetta.storage,vendetta.ui.assets,vendetta.ui.components,window.React,vendetta.metro.common.ReactNative); diff --git a/NoAutoReplyMention/manifest.json b/NoAutoReplyMention/manifest.json index ed2f24c..7e85734 100644 --- a/NoAutoReplyMention/manifest.json +++ b/NoAutoReplyMention/manifest.json @@ -1 +1 @@ -{"authors":[{"name":"pylix","id":"492949202121261067"}],"main":"index.js","name":"NoAutoReplyMention","description":"Turns off auto mention when replying to someone.","vendetta":{"icon":"ic_notif_off"},"hash":"7f06c65c6ccc4e8e912a5ecdeef2a56872662b918b48174034c38245f07d74f0"} \ No newline at end of file +{"authors":[{"name":"pylix","id":"492949202121261067"}],"main":"index.js","name":"NoAutoReplyMention","description":"Turns off auto mention when replying to someone.","vendetta":{"icon":"ic_notif_off"},"hash":"4ca2dc122f625dd6de9e08cf77fa382b54b8f7b4f6771d2db6a9d928319ad1e0"} \ No newline at end of file diff --git a/NoIdle/index.js b/NoIdle/index.js index d03836b..df6550f 100644 --- a/NoIdle/index.js +++ b/NoIdle/index.js @@ -1 +1 @@ -(function(t,u,o){"use strict";function r(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function f(e,n){for(var l=0;l0:t||t===0||t===!1}function x(t){return JSON.parse(JSON.stringify(t,function(l,e){if(e===t)return e;if(!(typeof l=="string"&&l.startsWith("_")))switch(typeof e){case"object":{if(Array.isArray(e)&&e.length===0)return;const a=Object.entries(e).filter(function(F){return h(F[1])});return a.length>0?Object.fromEntries(a):void 0}default:return h(e)?e:void 0}}))}var d;(function(t){t[t.PLAYING=0]="PLAYING",t[t.STREAMING=1]="STREAMING",t[t.LISTENING=2]="LISTENING",t[t.WATCHING=3]="WATCHING",t[t.COMPETING=5]="COMPETING"})(d||(d={}));const y=_.findByProps("getAssetIds"),E=Date.now(),o=s.plugin.storage;typeof o.selected?.length!="number"&&Object.assign(o,{selected:"default",selections:{default:k()}});function k(){return{name:"Discord",application_id:"1054951789318909972",flags:0,type:d.PLAYING,timestamps:{_enabled:!1,start:E},assets:{},buttons:[{},{}]}}async function R(t){if(typeof t!="object")throw new Error("Invalid activity");const l=t?.timestamps?._enabled;if(t=x(t),l?t.timestamps.start||=E:delete t.timestamps,t?.assets){const e=[t.application_id,[t.assets.large_image,t.assets.small_image]];let a=y.getAssetIds(...e);a.length||(a=await y.fetchAssetIds(...e)),t.assets.large_image=a[0],t.assets.small_image=a[1]}return t?.buttons?.length&&(t.buttons=t.buttons.filter(function(e){return e.label&&e.url}),t.buttons.length?Object.assign(t,{metadata:{button_urls:t.buttons.map(function(e){return e.url})},buttons:t.buttons.map(function(e){return e.label})}):delete t.buttons),n.FluxDispatcher.dispatch({type:"LOCAL_ACTIVITY_UPDATE",activity:t,pid:1608,socketId:"RichPresence@Vendetta"}),t}var O=new(function(){function t(){I(this,t),w(this,"settings",P)}return S(t,[{key:"onLoad",value:function(){s.logger.log("Sending RPC request");const l=o.selections[o.selected];if(!l)throw new Error("Selected activity does not exist");R(l).then(function(e){s.logger.log("RPC request sent"),s.logger.log(e)}).catch(function(e){s.logger.error("An error occured while sending RPC request :("),s.logger.error(e?.stack??e)})}},{key:"onUnload",value:function(){s.logger.log("Stopping RPC request"),R(null)}}]),t}());return u.default=O,Object.defineProperty(u,"__esModule",{value:!0}),u})({},vendetta,vendetta.metro,vendetta.metro.common,vendetta.plugin,vendetta.storage,vendetta.ui,vendetta.ui.components,vendetta.metro.common.ReactNative); diff --git a/RichPresence/manifest.json b/RichPresence/manifest.json index 0179f45..402ff5a 100644 --- a/RichPresence/manifest.json +++ b/RichPresence/manifest.json @@ -1 +1 @@ -{"authors":[{"name":"pylix","id":"492949202121261067"}],"main":"index.js","name":"RichPresence","description":"Sets Discord Rich Presence for your profile.","vendetta":{"icon":"games"},"hash":"766a4a396a8723e70994b7f770978e9bcce542f396ca6dd7b5e8e3f4bec45c80"} \ No newline at end of file +{"authors":[{"name":"pylix","id":"492949202121261067"}],"main":"index.js","name":"RichPresence","description":"Sets Discord Rich Presence for your profile.","vendetta":{"icon":"games"},"hash":"23b1d878fef631d419f07643bfefcede5bf289e6e7ee1f7b021d3b5cfe4251d7"} \ No newline at end of file