7 lines
21 KiB
JavaScript
7 lines
21 KiB
JavaScript
(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: ${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);
|