diff --git a/.gitignore b/.gitignore deleted file mode 100644 index c49051a..0000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules/ -dist/ -package-lock.json -plugins diff --git a/Commands/index.js b/Commands/index.js index ffbe286..1e764bb 100644 --- a/Commands/index.js +++ b/Commands/index.js @@ -1,4 +1,7 @@ -(function(v,q,s,g,M,S,C,i,K,G){"use strict";const U=g.findByProps("sendMessage"),p=function(n,t,a,e,o){if(!t)return{type:4};if(o)return{type:4,data:{content:t,flags:64}};const l={content:t,...a&&e?.factSettings?.sendAsReply?{messageReference:{messageId:a}}:{}};return U.sendMessage(n,l,void 0,{nonce:(Date.now()*4194304).toString()}),{type:4}},z=async function(){const n=await(await fetch("https://uselessfacts.jsph.pl/api/v2/facts/random")).json();return{text:n.text,source:n.source,language:n.language}},H=async function(){return{text:(await(await fetch("https://dogapi.dog/api/v2/facts?limit=1")).json()).data[0].attributes.body}},Y=async function(){const n=await(await fetch("https://catfact.ninja/fact")).json();return{text:n.fact,length:n.length}},J=async function(n){return await(await fetch(`https://api.obamabot.me/v2/image/petpet?image=${n.replace("webp","png")}`)).json()},D=function(n){let t=n.text;return s.storage.factSettings?.includeCitation&&n.source&&(t+=` +(function(A,H,s,g,C,v,r,z,X,Y){"use strict";const J=g.findByProps("sendMessage"),Q=function(t){return![4,10,11,12,13,15].includes(t)},y=function(t,n,a,e,o){if(!n)return{type:4};if(o)return{type:4,data:{content:n,flags:64}};try{const i={content:n,...a&&e?.factSettings?.sendAsReply?{messageReference:{messageId:a}}:{}},d=(BigInt(Date.now())*BigInt(4194304)+BigInt(Math.floor(Math.random()*4194304))).toString();return J.sendMessage(t,i,void 0,{nonce:d}),{type:4}}catch(i){return console.error("[Commands] Message send failed:",i),{type:4}}},h=function(t){return Q(t.channel.type)?null:{type:4,data:{content:"This command cannot be used in threads, forum channels, or voice channels.",flags:64}}},Z=async function(){const t=await(await fetch("https://uselessfacts.jsph.pl/api/v2/facts/random")).json();return{text:t.text,source:t.source,language:t.language}},ee=async function(){return{text:(await(await fetch("https://dogapi.dog/api/v2/facts?limit=1")).json()).data[0].attributes.body}},te=async function(){const t=await(await fetch("https://catfact.ninja/fact")).json();return{text:t.fact,length:t.length}},ne=async function(t){return await(await fetch(`https://api.obamabot.me/v2/image/petpet?image=${t.replace("webp","png")}`)).json()},M=function(t){let n=t.text;return s.storage.factSettings?.includeCitation&&t.source&&(n+=` -Source: ${n.source}`),t},Q={name:"catfact",displayName:"catfact",description:"Sends a random cat fact.",displayDescription:"Sends a random cat fact.",applicationId:"-1",inputType:1,type:1,execute:async function(n,t){const a=await Y();return p(t.channel.id,D(a),t.message?.id,s.storage)}},X={name:"dogfact",displayName:"dogfact",description:"Sends a dog fact.",displayDescription:"Sends a dog fact.",applicationId:"-1",inputType:1,type:1,execute:async function(n,t){const a=await H();return p(t.channel.id,D(a),t.message?.id,s.storage)}},Z={name:"useless",displayName:"useless",description:"Sends a useless fact.",displayDescription:"Sends a useless fact.",applicationId:"-1",inputType:1,type:1,execute:async function(n,t){const a=await z();return p(t.channel.id,D(a),t.message?.id,s.storage)}},E="https://vd-plugins.github.io/proxy/actuallythesun.github.io/vendetta-plugins/SplitLargeMessages/",h={ENABLED:"\u{1F7E2}",DISABLED:"\u{1F534}",SELECTED:"\u{1F536}",NOT_SELECTED:"\u{1F537}"},$=function(n){return n.map(function(t){return t.name}).join(", ")},L=function(n){return n.join(` -`).trimEnd()},N=function(n){return L(n).length},x=function(){return Object.keys(S.plugins).includes(E)},P=function(){return Object.values(S.plugins).find(function(n){return n.id===E})?.enabled??!1},k=function(){return C.alerts.showConfirmationAlert({title:"Large Message Warning",content:"This list is too long to send! Would you like to install the Split Large Messages plugin?",confirmText:"Install Plugin",cancelText:"Cancel",confirmColor:"brand",onConfirm:function(){i.openURL(E)}})},I=function(){return C.alerts.showConfirmationAlert({title:"Plugin Disabled",content:"The Split Large Messages plugin is installed but disabled. Would you like to enable it now?",confirmText:"Enable Plugin",cancelText:"Cancel",confirmColor:"brand",onConfirm:function(){const n=Object.values(S.plugins).find(function(t){return t.id===E});n&&(n.enabled=!0)}})};async function ee(n,t){const a=s.storage.listSettings?.pluginListAlwaysDetailed??!1,e=[`**My Plugin List | ${Object.keys(S.plugins).length} Plugins**`,""];for(const o of Object.values(S.plugins)){const{enabled:l,manifest:d,id:f}=o,{name:m,description:u,authors:r}=d;n||a?e.push(`> **Name**: ${m}`,`> **Status**: ${l?h.ENABLED:h.DISABLED}`,`> **Description**: ${u}`,`> **Authors**: ${$(r)}`,`> **[Install!](${f})**`,""):e.push(`> ${l?h.ENABLED:h.DISABLED} **${m}** by ${$(r)}`)}return N(e)>2e3?x()?P()?C.alerts.showConfirmationAlert({title:"Large Message",content:"This list is over 2000 characters. Send anyway?",confirmText:"Send",cancelText:"Cancel",onConfirm:function(){return p(t.channel.id,L(e))}}):I():k():p(t.channel.id,L(e))}async function te(n,t){const a=s.storage.themeListAlwaysDetailed??!1,e=[`**My Theme List | ${Object.keys(M.themes).length} Themes**`,""],o=Object.values(M.themes);if(o.length)for(const l of o){const{selected:d,data:f,id:m}=l,{name:u,description:r,authors:b}=f;n||a?e.push(`> **Name**: ${u}`,`> **Selected**: ${d?h.SELECTED:h.NOT_SELECTED}`,`> **Description**: ${r}`,`> **Authors**: ${$(b)}`,`> **[Install!](${m})**`,""):e.push(`> ${d?h.SELECTED:h.NOT_SELECTED} **${u}** by ${$(b)}`)}else e.push("Nothing to see here, huh...");return N(e)>2e3?x()?P()?C.alerts.showConfirmationAlert({title:"Large Message",content:"This list is over 2000 characters. Send anyway?",confirmText:"Send",cancelText:"Cancel",onConfirm:function(){return p(t.channel.id,L(e))}}):I():k():p(t.channel.id,L(e))}const ne={name:"plugin-list",displayName:"plugin list",description:"Send your plugin list to the current channel",displayDescription:"Send your plugin list to the current channel",options:[{name:"detailed",description:"Whether to send a list with detailed information.",type:5,required:!1,displayName:"detailed",displayDescription:"Whether to send a list with detailed information."}],execute:async function(n,t){const a=n.find(function(e){return e.name==="detailed"})?.value??!1;return ee(a,t)},applicationId:"-1",inputType:1,type:1},ae={name:"theme-list",displayName:"theme list",description:"Send your theme list to the current channel",displayDescription:"Send your theme list to the current channel",options:[{name:"detailed",description:"Whether to send a list with detailed information.",type:5,required:!1,displayName:"detailed",displayDescription:"Whether to send a list with detailed information."}],execute:async function(n,t){const a=n.find(function(e){return e.name==="detailed"})?.value??!1;return te(a,t)},applicationId:"-1",inputType:1,type:1},se=g.findByStoreName("UserStore"),ie={name:"petpet",displayName:"petpet",description:"PetPet someone",displayDescription:"PetPet someone",options:[{name:"user",description:"The user(or their id) to be patted",type:6,required:!0,displayName:"user",displayDescription:"The user(or their id) to be patted"}],execute:async function(n,t){const a=(await se.getUser(n[0].value)).getAvatarURL(512),e=await J(a);return p(t.channel.id,e.url,t.message?.id)},applicationId:"-1",inputType:1,type:1},F=g.findByProps("sendMessage"),B=g.findByProps("sendBotMessage","sendMessage","receiveMessage"),j=async function(n){const t="https://konachan.com/post.json",a=n?"rating:explicit":"rating:safe",e=Math.floor(Math.random()*100);try{const o=await(await fetch(`${t}?tags=${a}&limit=1&page=${e}`)).json();return!Array.isArray(o)||o.length===0?null:o[0].file_url}catch(o){return console.error("[KonoChan Randomizer] Error fetching image:",o),null}},O=function(){return C.alerts.showConfirmationAlert({title:"NSFW Content Warning",content:"NSFW content can only be sent in NSFW channels!",confirmText:"Okay",cancelText:null,confirmColor:"brand",isDismissable:!0})},_={name:"nsfw",description:"Include NSFW content?",type:5,required:!1,displayName:"nsfw",displayDescription:"Include NSFW content?"},oe={name:"konoself",displayName:"konoself",description:"Fetch a random image from KonoChan for yourself.",displayDescription:"Fetch a random image from KonoChan for yourself.",options:[_],execute:async function(n,t){const a=new Map(n.map(function(o){return[o.name,o]})).get("nsfw")?.value||!1;if(a&&!t.channel.nsfw)return O(),{type:4};const e=await j(a);return e?(B.sendBotMessage(t.channel.id,`Here's your random image: ${e}`),{type:4}):(B.sendBotMessage(t.channel.id,"No image found. Try again later."),{type:4})},applicationId:"-1",inputType:1,type:1},re={name:"konosend",displayName:"konosend",description:"Fetch a random image from KonoChan and send it to the channel.",displayDescription:"Fetch a random image from KonoChan and send it to the channel.",options:[_],execute:async function(n,t){const a=new Map(n.map(function(l){return[l.name,l]})).get("nsfw")?.value||!1;if(a&&!t.channel.nsfw)return O(),{type:4};const e=await j(a);if(!e){const l=Date.now().toString();return F.sendMessage(t.channel.id,{content:"No image found. Try again later."},void 0,{nonce:l}),{type:4}}const o=Date.now().toString();return F.sendMessage(t.channel.id,{content:e},void 0,{nonce:o}),{type:4}},applicationId:"-1",inputType:1,type:1},V=g.findByProps("getAPIBaseURL","get"),le=g.findByProps("sendMessage"),T=g.findByProps("sendBotMessage","sendMessage","receiveMessage"),R=async function(n,t,a){const e=t?`&author_id=${t}`:"",o=a?`&channel_id=${a}`:"",l=t?"":"&min_id=0";return(await V.get({url:`/guilds/${n}/messages/search`,query:`include_nsfw=true${e}${o}${l}&sort_by=timestamp&sort_order=asc&offset=0`})).body.messages[0][0]},W=async function(n,t){const a=t?`&author_id=${t}`:"",e=t?"":"&min_id=0";return(await V.get({url:`/channels/${n}/messages/search`,query:`&sort_by=timestamp&sort_order=asc&offset=0${a}${e}`})).body.messages[0][0]},ce={name:"firstmessage",displayName:"firstmessage",description:"Tired of scrolling to first message?",displayDescription:"Tired of scrolling to first message?",options:[{name:"user",displayName:"user",description:"Target user to get their first message in this server/dm",displayDescription:"Target user to get their first message in this server/dm",type:6,required:!1},{name:"channel",displayName:"channel",description:"Target channel to get first message of",displayDescription:"Target channel to get first message of",type:7,required:!1},{name:"send",displayName:"send",description:"Whether to send the resulting url",displayDescription:"Whether to send the resulting url",type:5,required:!1}],execute:async function(n,t){try{const a=new Map(n.map(function(b){return[b.name,b]})),e=a.get("user")?.value,o=a.get("channel")?.value,l=a.get("send")?.value,d=t.guild?.id,f=t.channel.id,m=t.channel.type===1;let u="https://discord.com/channels/",r;if(!e&&!o)m?(r=await W(f),u+=`@me/${f}/${r.id}`):(r=await R(d),u+=`${d}/${r.channel_id}/${r.id}`);else if(e)m?(r=await W(f,e),u+=`@me/${f}/${r.id}`):(r=await R(d,e),u+=`${d}/${r.channel_id}/${r.id}`);else if(o){if(m)return T.sendBotMessage(f,"This combination cannot be used in DMs!"),{type:4};r=await R(d,null,o),u+=`${d}/${o}/${r.id}`}else{if(m)return T.sendBotMessage(f,"This combination cannot be used in DMs!"),{type:4};r=await R(d,e,o),u+=`${d}/${o}/${r.id}`}if(l){const b=Date.now().toString();return le.sendMessage(t.channel.id,{content:u},void 0,{nonce:b}),{type:4}}else return i.url.openDeeplink(u),{type:4}}catch(a){return console.error("[FirstMessage] Error:",a),T.sendBotMessage(t.channel.id,"Failed to fetch the first message. Please try again."),{type:4}}},applicationId:"-1",inputType:1,type:1},{ScrollView:de}=g.findByProps("ScrollView"),{TableRowGroup:y,TableSwitchRow:c,Stack:ue,TableRow:w}=g.findByProps("TableSwitchRow","TableRowGroup","Stack","TableRow");s.storage.factSettings||(s.storage.factSettings={sendAsReply:!0,includeCitation:!1}),s.storage.listSettings||(s.storage.listSettings={pluginListAlwaysDetailed:!1,themeListAlwaysDetailed:!1}),s.storage.enabledCommands||(s.storage.enabledCommands={catfact:!0,dogfact:!0,useless:!0,petpet:!0,pluginList:!0,themeList:!0,konoself:!0,konosend:!0,firstmessage:!0}),s.storage.pendingRestart||(s.storage.pendingRestart=!1);function fe(){K.useProxy(s.storage);const[n,t]=i.React.useReducer(function(e){return e+1},0);i.React.useEffect(function(){return function(){s.storage.pendingRestart&&(s.storage.pendingRestart=!1,C.alerts.showConfirmationAlert({title:"Restart Required",content:"You have made changes to commands. Please restart Discord to apply these changes.",confirmText:"Okay",cancelText:null}))}},[]);const a=function(e,o){s.storage.enabledCommands[e]=o,s.storage.pendingRestart=!0,t()};return i.React.createElement(G.View,{style:{flex:1}},i.React.createElement(de,{style:{flex:1},contentContainerStyle:{paddingBottom:38}},i.React.createElement(ue,{spacing:8},i.React.createElement(y,{title:"Facts Commands"},i.React.createElement(c,{label:"Send as Reply",subLabel:"Send facts as a reply to the command message",value:s.storage.factSettings?.sendAsReply??!0,onValueChange:function(e){s.storage.factSettings.sendAsReply=e,t()}}),i.React.createElement(c,{label:"Include Source Citation",subLabel:"Include the source of facts when available",value:s.storage.factSettings?.includeCitation??!1,onValueChange:function(e){s.storage.factSettings.includeCitation=e,t()}}),i.React.createElement(c,{label:"/catfact",subLabel:"Get random cat facts",value:s.storage.enabledCommands?.catfact??!0,onValueChange:function(e){return a("catfact",e)}}),i.React.createElement(c,{label:"/dogfact",subLabel:"Get random dog facts",value:s.storage.enabledCommands?.dogfact??!0,onValueChange:function(e){return a("dogfact",e)}}),i.React.createElement(c,{label:"/useless",subLabel:"Get random useless facts",value:s.storage.enabledCommands?.useless??!0,onValueChange:function(e){return a("useless",e)}})),i.React.createElement(y,{title:"List Commands"},i.React.createElement(c,{label:"Always Send Detailed Plugin List",subLabel:"Always use detailed mode when listing plugins",value:s.storage.listSettings?.pluginListAlwaysDetailed??!1,onValueChange:function(e){s.storage.listSettings.pluginListAlwaysDetailed=e,t()}}),i.React.createElement(c,{label:"Always Send Detailed Theme List",subLabel:"Always use detailed mode when listing themes",value:s.storage.listSettings?.themeListAlwaysDetailed??!1,onValueChange:function(e){s.storage.listSettings.themeListAlwaysDetailed=e,t()}}),i.React.createElement(c,{label:"/plugin-list",subLabel:"List all installed plugins",value:s.storage.enabledCommands?.pluginList??!0,onValueChange:function(e){return a("pluginList",e)}}),i.React.createElement(c,{label:"/theme-list",subLabel:"List all installed themes",value:s.storage.enabledCommands?.themeList??!0,onValueChange:function(e){return a("themeList",e)}})),i.React.createElement(y,{title:"Image Commands"},i.React.createElement(c,{label:"/petpet",subLabel:"Create pet-pet GIF of a user",value:s.storage.enabledCommands?.petpet??!0,onValueChange:function(e){return a("petpet",e)}})),i.React.createElement(y,{title:"KonoChan Commands"},i.React.createElement(c,{label:"/konoself",subLabel:"Get random image from KonoChan (private)",value:s.storage.enabledCommands?.konoself??!0,onValueChange:function(e){return a("konoself",e)}}),i.React.createElement(c,{label:"/konosend",subLabel:"Send random image from KonoChan to channel",value:s.storage.enabledCommands?.konosend??!0,onValueChange:function(e){return a("konosend",e)}})),i.React.createElement(y,{title:"Message Commands"},i.React.createElement(c,{label:"/firstmessage",subLabel:"Get the first message in a channel",value:s.storage.enabledCommands?.firstmessage??!0,onValueChange:function(e){return a("firstmessage",e)}})),i.React.createElement(y,{title:"Credits"},i.React.createElement(w,{label:"Facts Commands",subLabel:"by jdev082"}),i.React.createElement(w,{label:"List Commands",subLabel:"by Kitomanari"}),i.React.createElement(w,{label:"PetPet Command",subLabel:"by wolfieeee"}),i.React.createElement(w,{label:"KonoChan Commands",subLabel:"by btmc727 & Rico040"}),i.React.createElement(w,{label:"FirstMessage Command",subLabel:"by sapphire"})),i.React.createElement(y,{title:"About"},i.React.createElement(w,{label:"All-In-One Commands",subLabel:"A collection of useful commands"})))))}s.storage.factSettings||(s.storage.factSettings={sendAsReply:!0,includeCitation:!1}),s.storage.listSettings||(s.storage.listSettings={pluginListAlwaysDetailed:!1,themeListAlwaysDetailed:!1}),s.storage.enabledCommands||(s.storage.enabledCommands={catfact:!0,dogfact:!0,useless:!0,petpet:!0,pluginList:!0,themeList:!0,konoself:!0,konosend:!0,firstmessage:!0});const ge={catfact:Q,dogfact:X,useless:Z,petpet:ie,pluginList:ne,themeList:ae,konoself:oe,konosend:re,firstmessage:ce};let A=[];var me={onLoad:function(){console.log("[All-In-One Commands] Loading plugin...");for(const[n,t]of Object.entries(ge))s.storage.enabledCommands[n]&&A.push(q.registerCommand(t));console.log("[All-In-One Commands] Plugin loaded successfully!")},onUnload:function(){console.log("[All-In-One Commands] Unloading plugin..."),A.forEach(function(n){return n()}),A=[],console.log("[All-In-One Commands] Plugin unloaded successfully!")},settings:fe};return v.default=me,Object.defineProperty(v,"__esModule",{value:!0}),v})({},vendetta.commands,vendetta.plugin,vendetta.metro,vendetta.themes,vendetta.plugins,vendetta.ui,vendetta.metro.common,vendetta.storage,vendetta.metro.common.ReactNative); +Source: ${t.source}`),n},ae={name:"catfact",displayName:"catfact",description:"Sends a random cat fact.",displayDescription:"Sends a random cat fact.",applicationId:"-1",inputType:1,type:1,execute:async function(t,n){const a=h(n);if(a)return a;try{const e=await te();return y(n.channel.id,M(e),n.message?.id,s.storage)}catch(e){return console.error("[CatFact] Error:",e),{type:4}}}},se={name:"dogfact",displayName:"dogfact",description:"Sends a dog fact.",displayDescription:"Sends a dog fact.",applicationId:"-1",inputType:1,type:1,execute:async function(t,n){const a=h(n);if(a)return a;try{const e=await ee();return y(n.channel.id,M(e),n.message?.id,s.storage)}catch(e){return console.error("[DogFact] Error:",e),{type:4}}}},oe={name:"useless",displayName:"useless",description:"Sends a useless fact.",displayDescription:"Sends a useless fact.",applicationId:"-1",inputType:1,type:1,execute:async function(t,n){const a=h(n);if(a)return a;try{const e=await Z();return y(n.channel.id,M(e),n.message?.id,s.storage)}catch(e){return console.error("[UselessFact] Error:",e),{type:4}}}},N="github.com/fres621/vendetta-plugins",b={ENABLED:"\u2705",DISABLED:"\u274C",SELECTED:"\u2705",NOT_SELECTED:"\u274C"},D=function(t){return!t||t.length===0?"Unknown":t.map(function(n){return n.name}).join(", ")},L=function(t){return t.join(` +`)},I=function(t){return L(t).length},k=function(){return Object.values(C.plugins).some(function(t){return t.id===N})},P=function(){return Object.values(C.plugins).find(function(t){return t.id===N})?.enabled??!1},B=function(){return v.alerts.showConfirmationAlert({title:"Install Split Large Messages Plugin",content:"This list is over 2000 characters. Install the Split Large Messages plugin to send it.",confirmText:"Install",cancelText:"Cancel",onConfirm:function(){}})},x=function(){return v.alerts.showConfirmationAlert({title:"Enable Split Large Messages Plugin",content:"This list is over 2000 characters. Enable the Split Large Messages plugin to send it.",confirmText:"Enable",cancelText:"Cancel",onConfirm:function(){const t=Object.values(C.plugins).find(function(n){return n.id===N});t&&(t.enabled=!0)}})};async function re(t,n){const a=s.storage.listSettings?.pluginListAlwaysDetailed??!1,e=[`**My Plugin List | ${Object.keys(C.plugins).length} Plugins**`,""];for(const o of Object.values(C.plugins)){const{enabled:i,manifest:d,id:c}=o,{name:m,description:u,authors:l}=d;t||a?e.push(`> **Name**: ${m}`,`> **Status**: ${i?b.ENABLED:b.DISABLED}`,`> **Description**: ${u}`,`> **Authors**: ${D(l)}`,`> **[Install!](${c})**`,""):e.push(`> ${i?b.ENABLED:b.DISABLED} **${m}** by ${D(l)}`)}return I(e)>2e3?k()?P()?v.alerts.showConfirmationAlert({title:"Large Message",content:"This list is over 2000 characters. Send anyway?",confirmText:"Send",cancelText:"Cancel",onConfirm:function(){return y(n.channel.id,L(e))}}):x():B():y(n.channel.id,L(e))}async function ie(t,n){const a=s.storage.themeListAlwaysDetailed??!1,e=[`**My Theme List | ${Object.keys(C.themes).length} Themes**`,""],o=Object.values(C.themes);if(o.length)for(const i of o){const{selected:d,data:c,id:m}=i,{name:u,description:l,authors:f}=c;t||a?e.push(`> **Name**: ${u}`,`> **Selected**: ${d?b.SELECTED:b.NOT_SELECTED}`,`> **Description**: ${l}`,`> **Authors**: ${D(f)}`,`> **[Install!](${m})**`,""):e.push(`> ${d?b.SELECTED:b.NOT_SELECTED} **${u}** by ${D(f)}`)}else e.push("Nothing to see here, huh...");return I(e)>2e3?k()?P()?v.alerts.showConfirmationAlert({title:"Large Message",content:"This list is over 2000 characters. Send anyway?",confirmText:"Send",cancelText:"Cancel",onConfirm:function(){return y(n.channel.id,L(e))}}):x():B():y(n.channel.id,L(e))}const ce={name:"plugin-list",displayName:"plugin list",description:"Send your plugin list to the current channel",displayDescription:"Send your plugin list to the current channel",options:[{name:"detailed",description:"Whether to send a list with detailed information.",type:5,required:!1,displayName:"detailed",displayDescription:"Whether to send a list with detailed information."}],execute:async function(t,n){const a=h(n);if(a)return a;try{const e=t.find(function(o){return o.name==="detailed"})?.value??!1;return re(e,n)}catch(e){return console.error("[PluginList] Error:",e),{type:4}}},applicationId:"-1",inputType:1,type:1},le={name:"theme-list",displayName:"theme list",description:"Send your theme list to the current channel",displayDescription:"Send your theme list to the current channel",options:[{name:"detailed",description:"Whether to send a list with detailed information.",type:5,required:!1,displayName:"detailed",displayDescription:"Whether to send a list with detailed information."}],execute:async function(t,n){const a=h(n);if(a)return a;try{const e=t.find(function(o){return o.name==="detailed"})?.value??!1;return ie(e,n)}catch(e){return console.error("[ThemeList] Error:",e),{type:4}}},applicationId:"-1",inputType:1,type:1},de=g.findByStoreName("UserStore"),ue={name:"petpet",displayName:"petpet",description:"PetPet someone",displayDescription:"PetPet someone",options:[{name:"user",description:"The user(or their id) to be patted",type:6,required:!0,displayName:"user",displayDescription:"The user(or their id) to be patted"}],execute:async function(t,n){const a=h(n);if(a)return a;try{const e=(await de.getUser(t[0].value)).getAvatarURL(512),o=await ne(e);return y(n.channel.id,o.url,n.message?.id)}catch(e){return console.error("[PetPet] Error:",e),{type:4}}},applicationId:"-1",inputType:1,type:1},fe=g.findByProps("sendMessage"),me=g.findByProps("sendBotMessage","sendMessage","receiveMessage"),U=async function(t){const n="https://konachan.com/post.json",a=t?"rating:explicit":"rating:safe",e=Math.floor(Math.random()*100);try{const o=await(await fetch(`${n}?tags=${a}&limit=1&page=${e}`)).json();return!Array.isArray(o)||o.length===0?null:o[0].file_url}catch(o){return console.error("[KonoChan Randomizer] Error fetching image:",o),null}},F=function(){return v.alerts.showConfirmationAlert({title:"NSFW Content Warning",content:"NSFW content can only be sent in NSFW channels!",confirmText:"Okay",cancelText:null,confirmColor:"brand",isDismissable:!0})},pe=function(){return(BigInt(Date.now())*BigInt(4194304)+BigInt(Math.floor(Math.random()*4194304))).toString()},j={name:"nsfw",description:"Include NSFW content?",type:5,required:!1,displayName:"nsfw",displayDescription:"Include NSFW content?"},ge={name:"konoself",displayName:"konoself",description:"Fetch a random image from KonoChan for yourself.",displayDescription:"Fetch a random image from KonoChan for yourself.",options:[j],execute:async function(t,n){const a=h(n);if(a)return a;try{const e=new Map(t.map(function(i){return[i.name,i]})).get("nsfw")?.value||!1;if(e&&!n.channel.nsfw)return F(),{type:4};const o=await U(e);return o?(me.sendBotMessage(n.channel.id,`Here's your random image: ${o}`),{type:4}):{type:4}}catch(e){return console.error("[KonoSelf] Error:",e),{type:4}}},applicationId:"-1",inputType:1,type:1},he={name:"konosend",displayName:"konosend",description:"Fetch a random image from KonoChan and send it to the channel.",displayDescription:"Fetch a random image from KonoChan and send it to the channel.",options:[j],execute:async function(t,n){const a=h(n);if(a)return a;try{const e=new Map(t.map(function(d){return[d.name,d]})).get("nsfw")?.value||!1;if(e&&!n.channel.nsfw)return F(),{type:4};const o=await U(e);if(!o)return{type:4};const i=pe();return fe.sendMessage(n.channel.id,{content:o},void 0,{nonce:i}),{type:4}}catch(e){return console.error("[KonoSend] Error:",e),{type:4}}},applicationId:"-1",inputType:1,type:1},V=g.findByProps("getAPIBaseURL","get"),ye=g.findByProps("sendMessage");g.findByProps("sendBotMessage","sendMessage","receiveMessage");const be=function(){return(BigInt(Date.now())*BigInt(4194304)+BigInt(Math.floor(Math.random()*4194304))).toString()},$=async function(t,n,a){const e=n?`&author_id=${n}`:"",o=a?`&channel_id=${a}`:"",i=n?"":"&min_id=0";return(await V.get({url:`/guilds/${t}/messages/search`,query:`include_nsfw=true${e}${o}${i}&sort_by=timestamp&sort_order=asc&offset=0`})).body.messages[0][0]},O=async function(t,n){const a=n?`&author_id=${n}`:"",e=n?"":"&min_id=0";return(await V.get({url:`/channels/${t}/messages/search`,query:`&sort_by=timestamp&sort_order=asc&offset=0${a}${e}`})).body.messages[0][0]},we={name:"firstmessage",displayName:"firstmessage",description:"Tired of scrolling to first message?",displayDescription:"Tired of scrolling to first message?",options:[{name:"user",displayName:"user",description:"Target user to get their first message in this server/dm",displayDescription:"Target user to get their first message in this server/dm",type:6,required:!1},{name:"channel",displayName:"channel",description:"Target channel to get first message of",displayDescription:"Target channel to get first message of",type:7,required:!1},{name:"send",displayName:"send",description:"Whether to send the resulting url",displayDescription:"Whether to send the resulting url",type:5,required:!1}],execute:async function(t,n){if(n.channel.type>=10&&n.channel.type<=15)return{type:4,data:{content:"FirstMessage command doesn't work in thread or forum channels.",flags:64}};const a=h(n);if(a)return a;try{const e=new Map(t.map(function(E){return[E.name,E]})),o=e.get("user")?.value,i=e.get("channel")?.value,d=e.get("send")?.value,c=n.guild?.id,m=n.channel.id,u=n.channel.type===1;let l="https://discord.com/channels/",f;if(!o&&!i)u?(f=await O(m),l+=`@me/${m}/${f.id}`):(f=await $(c),l+=`${c}/${f.channel_id}/${f.id}`);else if(o)u?(f=await O(m,o),l+=`@me/${m}/${f.id}`):(f=await $(c,o),l+=`${c}/${f.channel_id}/${f.id}`);else if(i){if(u)return{type:4};f=await $(c,null,i),l+=`${c}/${i}/${f.id}`}else{if(u)return{type:4};f=await $(c,o,i),l+=`${c}/${i}/${f.id}`}if(d){const E=be();return ye.sendMessage(n.channel.id,{content:l},void 0,{nonce:E}),{type:4}}else return r.url.openDeeplink(l),{type:4}}catch(e){return console.error("[FirstMessage] Error:",e),{type:4}}},applicationId:"-1",inputType:1,type:1},Ce=g.findByProps("sendMessage"),Se=g.findByProps("sendBotMessage","sendMessage","receiveMessage");function ve(){let{height:t,width:n,scale:a}=r.ReactNative.Dimensions.get("screen");return t*=a,n*=a,{width:n,height:t}}function Ee(){try{const t=g.findByProps("memory");if(!t)return{cpuCoreCount:"N/A",cpuPerc:"N/A",memUsage:"N/A",netInfo:"N/A"};const{cpuCoreCount:n,cpuPercentage:a,memory:e}=t,o=a?a.toFixed(2)+"%":"N/A",i=e?parseFloat((e/1e3).toPrecision(3))+" MB":"N/A";let d="N/A";try{const c=g.findByProps("useNetInfo");if(c){const m=Object.values(c.fetch()).filter(function(u){return u?.type})[0];if(m){const{type:u,details:l}=m;d={wifi:"WiFi",ethernet:"Ethernet",other:"Unknown",bluetooth:"Bluetooth",wimax:"WiMAX",vpn:"VPN",cellular:l?.cellularGeneration?.toUpperCase()||"Cellular"}[u]??u}}}catch(c){console.warn("Network info unavailable:",c)}return{cpuCoreCount:n,cpuPerc:o,memUsage:i,netInfo:d}}catch(t){return console.warn("Hardware info unavailable:",t),{cpuCoreCount:"N/A",cpuPerc:"N/A",memUsage:"N/A",netInfo:"N/A"}}}function Le(){try{const{NativeModules:t}=r.ReactNative;return(t.InfoDictionaryManager??t.RTNClientInfoManager)||{}}catch(t){return console.warn("Discord info unavailable:",t),{}}}function De(){try{const{cpuCoreCount:t,cpuPerc:n,memUsage:a,netInfo:e}=Ee(),o=Le(),{vendetta:i,discord:d,react:c,hermes:m,os:u,device:l}=z.getDebugInfo(),{version:f,bytecodeVersion:E}=m||{},{version:Pe,nativeVersion:Be}=c||{},{name:K,version:xe,sdk:W}=u||{},{manufacturer:Ue,brand:q,model:G,codename:Fe}=l||{},{version:je}=i||{},{version:Ve,build:Oe}=d||{},{ReleaseChannel:_e}=o,Ke=K=="iOS"?Fe:`${q} ${G}`,{width:We,height:qe}=ve();let R={Device:{Device:Ke||"Unknown",Model:G||"Unknown",Manufacturer:Ue||"Unknown",Brand:q||"Unknown",Display:`${We}x${qe}`},Hardware:{"CPU Cores":t||"N/A",Network:e},Software:{OS:K||"Unknown",Version:xe||"Unknown"},Discord:{Branch:_e||"Unknown",Version:Ve||"Unknown",Build:Oe||"Unknown",Vendetta:je||"Unknown","CPU Usage":n,"Memory Usage":a},React:{Version:Pe||"Unknown","Hermes Bytecode":E||"Unknown",Hermes:f||"Unknown",Native:Be||"Unknown"}};return window.enmity&&(R.Discord.Enmity=window.enmity.version),window.aliucord&&(R.Discord.Aliucord=window.aliucord.version),W&&(R.Software["SDK Version"]=W),R}catch(t){throw console.error("Error generating system info:",t),t}}const _=["device","hardware","software","discord","react","ephemeral"];for(const t of _)s.storage[t]===void 0&&(s.storage[t]=!0);const $e=function(){return(BigInt(Date.now())*BigInt(4194304)+BigInt(Math.floor(Math.random()*4194304))).toString()};function Re(t,n){const a=h(n);if(a)return a;try{let e=[`__System Information__ +`];const o=De();Object.keys(o).forEach(function(c){const m=s.storage[c.toLowerCase()],u=t.find(function(l){return l.name==c.toLowerCase()})?.value??m;(u||m)&&!(m&&!u)&&(e.push(`[**${c}**]`),Object.keys(o[c]).forEach(function(l){e.push(`> ${l}: ${o[c][l]}`)}))});const i=s.storage.ephemeral,d=t.find(function(c){return c.name=="ephemeral"})?.value??i;if((d||i)&&!(i&&!d))return Se.sendBotMessage(n.channel.id,e.join(` +`)),{type:4};{const c=$e();return Ce.sendMessage(n.channel.id,{content:e.join(` +`)},void 0,{nonce:c}),{type:4}}}catch(e){return console.error("[Sysinfo] Error:",e),{type:4}}}const Ae={name:"sysinfo",displayName:"sysinfo",description:"Display system information",displayDescription:"Display system information",options:[{name:"ephemeral",displayName:"ephemeral",description:"Keep sysinfo ephemeral (default: true)",displayDescription:"Keep sysinfo ephemeral (default: true)",type:5,required:!1},..._.slice(0,-1).map(function(t){return{name:t,displayName:t,description:`Display the ${t} section. Set default in settings.`,displayDescription:`Display the ${t} section. Set default in settings.`,type:5,required:!1}})],execute:Re,applicationId:"-1",inputType:1,type:1},{ScrollView:Me}=g.findByProps("ScrollView"),{TableRowGroup:w,TableSwitchRow:p,Stack:Ne,TableRow:S}=g.findByProps("TableSwitchRow","TableRowGroup","Stack","TableRow");s.storage.factSettings||(s.storage.factSettings={sendAsReply:!0,includeCitation:!1}),s.storage.listSettings||(s.storage.listSettings={pluginListAlwaysDetailed:!1,themeListAlwaysDetailed:!1}),s.storage.enabledCommands||(s.storage.enabledCommands={catfact:!0,dogfact:!0,useless:!0,petpet:!0,pluginList:!0,themeList:!0,konoself:!0,konosend:!0,firstmessage:!0,sysinfo:!0}),s.storage.pendingRestart||(s.storage.pendingRestart=!1);function Te(){X.useProxy(s.storage);const[t,n]=r.React.useReducer(function(e){return e+1},0);r.React.useEffect(function(){return function(){s.storage.pendingRestart&&(s.storage.pendingRestart=!1,v.alerts.showConfirmationAlert({title:"Restart Required",content:"You have made changes to commands. Please restart Discord to apply these changes.",confirmText:"Okay",cancelText:null}))}},[]);const a=function(e,o){s.storage.enabledCommands[e]=o,s.storage.pendingRestart=!0,n()};return r.React.createElement(Y.View,{style:{flex:1}},r.React.createElement(Me,{style:{flex:1},contentContainerStyle:{paddingBottom:38}},r.React.createElement(Ne,{spacing:8},r.React.createElement(w,{title:"Facts Commands"},r.React.createElement(p,{label:"Send as Reply",subLabel:"Send facts as a reply to the command message",value:s.storage.factSettings?.sendAsReply??!0,onValueChange:function(e){s.storage.factSettings.sendAsReply=e,n()}}),r.React.createElement(p,{label:"Include Source Citation",subLabel:"Include the source of facts when available",value:s.storage.factSettings?.includeCitation??!1,onValueChange:function(e){s.storage.factSettings.includeCitation=e,n()}}),r.React.createElement(p,{label:"/catfact",subLabel:"Get random cat facts",value:s.storage.enabledCommands?.catfact??!0,onValueChange:function(e){return a("catfact",e)}}),r.React.createElement(p,{label:"/dogfact",subLabel:"Get random dog facts",value:s.storage.enabledCommands?.dogfact??!0,onValueChange:function(e){return a("dogfact",e)}}),r.React.createElement(p,{label:"/useless",subLabel:"Get random useless facts",value:s.storage.enabledCommands?.useless??!0,onValueChange:function(e){return a("useless",e)}})),r.React.createElement(w,{title:"List Commands"},r.React.createElement(p,{label:"Always Send Detailed Plugin List",subLabel:"Always use detailed mode when listing plugins",value:s.storage.listSettings?.pluginListAlwaysDetailed??!1,onValueChange:function(e){s.storage.listSettings.pluginListAlwaysDetailed=e,n()}}),r.React.createElement(p,{label:"Always Send Detailed Theme List",subLabel:"Always use detailed mode when listing themes",value:s.storage.listSettings?.themeListAlwaysDetailed??!1,onValueChange:function(e){s.storage.listSettings.themeListAlwaysDetailed=e,n()}}),r.React.createElement(p,{label:"/plugin-list",subLabel:"List all installed plugins",value:s.storage.enabledCommands?.pluginList??!0,onValueChange:function(e){return a("pluginList",e)}}),r.React.createElement(p,{label:"/theme-list",subLabel:"List all installed themes",value:s.storage.enabledCommands?.themeList??!0,onValueChange:function(e){return a("themeList",e)}})),r.React.createElement(w,{title:"Image Commands"},r.React.createElement(p,{label:"/petpet",subLabel:"Create pet-pet GIF of a user",value:s.storage.enabledCommands?.petpet??!0,onValueChange:function(e){return a("petpet",e)}})),r.React.createElement(w,{title:"KonoChan Commands"},r.React.createElement(p,{label:"/konoself",subLabel:"Get random image from KonoChan (private)",value:s.storage.enabledCommands?.konoself??!0,onValueChange:function(e){return a("konoself",e)}}),r.React.createElement(p,{label:"/konosend",subLabel:"Send random image from KonoChan to channel",value:s.storage.enabledCommands?.konosend??!0,onValueChange:function(e){return a("konosend",e)}})),r.React.createElement(w,{title:"Message Commands"},r.React.createElement(p,{label:"/firstmessage",subLabel:"Get the first message in a channel",value:s.storage.enabledCommands?.firstmessage??!0,onValueChange:function(e){return a("firstmessage",e)}})),r.React.createElement(w,{title:"System Commands"},r.React.createElement(p,{label:"/sysinfo",subLabel:"Display system information",value:s.storage.enabledCommands?.sysinfo??!0,onValueChange:function(e){return a("sysinfo",e)}})),r.React.createElement(w,{title:"Credits"},r.React.createElement(S,{label:"Facts Commands",subLabel:"by jdev082"}),r.React.createElement(S,{label:"List Commands",subLabel:"by Kitomanari"}),r.React.createElement(S,{label:"PetPet Command",subLabel:"by wolfieeee"}),r.React.createElement(S,{label:"KonoChan Commands",subLabel:"by btmc727 & Rico040"}),r.React.createElement(S,{label:"FirstMessage Command",subLabel:"by sapphire"}),r.React.createElement(S,{label:"Sysinfo Command",subLabel:"by kmmiio99o"})),r.React.createElement(w,{title:"About"},r.React.createElement(S,{label:"All-In-One Commands",subLabel:"A collection of useful commands"})))))}s.storage.factSettings||(s.storage.factSettings={sendAsReply:!0,includeCitation:!1}),s.storage.listSettings||(s.storage.listSettings={pluginListAlwaysDetailed:!1,themeListAlwaysDetailed:!1}),s.storage.enabledCommands||(s.storage.enabledCommands={catfact:!0,dogfact:!0,useless:!0,petpet:!0,pluginList:!0,themeList:!0,konoself:!0,konosend:!0,firstmessage:!0,sysinfo:!0});const Ie={catfact:ae,dogfact:se,useless:oe,petpet:ue,pluginList:ce,themeList:le,konoself:ge,konosend:he,firstmessage:we,sysinfo:Ae};let T=[];var ke={onLoad:function(){console.log("[All-In-One Commands] Loading plugin...");for(const[t,n]of Object.entries(Ie))s.storage.enabledCommands[t]&&T.push(H.registerCommand(n));console.log("[All-In-One Commands] Plugin loaded successfully!")},onUnload:function(){console.log("[All-In-One Commands] Unloading plugin..."),T.forEach(function(t){return t()}),T=[],console.log("[All-In-One Commands] Plugin unloaded successfully!")},settings:Te};return A.default=ke,Object.defineProperty(A,"__esModule",{value:!0}),A})({},vendetta.commands,vendetta.plugin,vendetta.metro,vendetta,vendetta.ui,vendetta.metro.common,vendetta.debug,vendetta.storage,vendetta.metro.common.ReactNative); diff --git a/Commands/manifest.json b/Commands/manifest.json index 305686a..1db6944 100644 --- a/Commands/manifest.json +++ b/Commands/manifest.json @@ -1 +1 @@ -{"authors":[{"name":"kmmiio99o","id":"879393496627306587"}],"main":"index.js","name":"Commands","description":"A collection of fixed commands including facts, petpet, and more.","vendetta":{"icon":"ic_badge_staff","original":"plugins/all-in-one"},"version":"1.0.0","hash":"70fc9a4a95c567a1558b4a9fba5aab78d19da7070c866127fb09b697a7e5aa04"} \ No newline at end of file +{"authors":[{"name":"kmmiio99o","id":"879393496627306587"}],"main":"index.js","name":"Commands","description":"A collection of fixed commands including facts, petpet, and more.","vendetta":{"icon":"ic_badge_staff","original":"plugins/all-in-one"},"version":"1.0.0","hash":"7a4f7b54c00a9af2a153e71644d5a307a2eeb9ce45b103632d4fa38eaa98229b"} \ No newline at end of file