6 lines
8.5 KiB
JavaScript
6 lines
8.5 KiB
JavaScript
(function(A,l,n,T,I,u,N,F,_,c,$){"use strict";const j=T.findByProps("sendMessage"),i=function(e,t,s,a){const r={content:t,...s&&a?.factSettings?.sendAsReply?{messageReference:{messageId:s}}:{}};return j.sendMessage(e,r,void 0,{nonce:BigInt(Date.now())<<22n}),{type:4}},O=async function(){const e=await(await fetch("https://uselessfacts.jsph.pl/api/v2/facts/random")).json();return{text:e.text,source:e.source,language:e.language}},M=async function(){return{text:(await(await fetch("https://dogapi.dog/api/v2/facts?limit=1")).json()).data[0].attributes.body}},Y=async function(){const e=await(await fetch("https://catfact.ninja/fact")).json();return{text:e.fact,length:e.length}},U=async function(e){return await(await fetch(`https://api.obamabot.me/v2/image/petpet?image=${e.replace("webp","png")}`)).json()},L=function(e){let t=e.text;return n.storage.factSettings?.includeCitation&&e.source&&(t+=`
|
|
|
|
Source: ${e.source}`),t},V={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(e,t){const s=await Y();return i(t.channel.id,L(s),t.message?.id,n.storage)}},k={name:"dogfact",displayName:"dogfact",description:"Sends a dog fact.",displayDescription:"Sends a dog fact.",applicationId:"-1",inputType:1,type:1,execute:async function(e,t){const s=await M();return i(t.channel.id,L(s),t.message?.id,n.storage)}},W={name:"useless",displayName:"useless",description:"Sends a useless fact.",displayDescription:"Sends a useless fact.",applicationId:"-1",inputType:1,type:1,execute:async function(e,t){const s=await O();return i(t.channel.id,L(s),t.message?.id,n.storage)}},g="https://vd-plugins.github.io/proxy/actuallythesun.github.io/vendetta-plugins/SplitLargeMessages/",o={ENABLED:"\u{1F7E2}",DISABLED:"\u{1F534}",SELECTED:"\u{1F536}",NOT_SELECTED:"\u{1F537}"},m=function(e){return e.map(function(t){return t.name}).join(", ")},d=function(e){return e.join(`
|
|
`).trimEnd()},R=function(e){return d(e).length},P=function(){return Object.keys(u.plugins).includes(g)},x=function(){return Object.values(u.plugins).find(function(e){return e.id===g})?.enabled??!1};async function q(e,t){const s=n.storage.listSettings?.pluginListAlwaysDetailed??!1,a=[`**My Plugin List | ${Object.keys(u.plugins).length} Plugins**`,""];for(const r of Object.values(u.plugins)){const{enabled:f,manifest:S,id:v}=r,{name:D,description:E,authors:b}=S;e||s?a.push(`> **Name**: ${D}`,`> **Status**: ${f?o.ENABLED:o.DISABLED}`,`> **Description**: ${E}`,`> **Authors**: ${m(b)}`,`> **[Install!](${v})**`,""):a.push(`> ${f?o.ENABLED:o.DISABLED} **${D}** by ${m(b)}`)}return R(a)>2e3?P()?x()?N.alerts.showConfirmationAlert({content:"Your list is over than 2000 characters. Are you sure?",confirmText:"Yes",cancelText:"No",onConfirm:function(){return i(t.channel.id,d(a))}}):i(t.channel.id,`Your list is too long to send it! You have the Split Large Messages plugin installed, but it's not enabled!
|
|
> Please enable it in order to send the list.`):i(t.channel.id,`Your list is too long to send it! Please install the [Split Large Messages](${g}) plugin.`):i(t.channel.id,d(a))}async function z(e,t){const s=n.storage.themeListAlwaysDetailed??!1,a=[`**My Theme List | ${Object.keys(I.themes).length} Themes**`,""],r=Object.values(I.themes);if(r.length)for(const f of r){const{selected:S,data:v,id:D}=f,{name:E,description:b,authors:B}=v;e||s?a.push(`> **Name**: ${E}`,`> **Selected**: ${S?o.SELECTED:o.NOT_SELECTED}`,`> **Description**: ${b}`,`> **Authors**: ${m(B)}`,`> **[Install!](${D})**`,""):a.push(`> ${S?o.SELECTED:o.NOT_SELECTED} **${E}** by ${m(B)}`)}else a.push("Nothing to see here, huh...");return R(a)>2e3?P()?x()?N.alerts.showConfirmationAlert({content:"Your list is over than 2000 characters. Are you sure?",confirmText:"Yes",cancelText:"No",onConfirm:function(){return i(t.channel.id,d(a))}}):i(t.channel.id,`Your list is too long to send it! You have the Split Large Messages plugin installed, but it's not enabled!
|
|
> Please enable it in order to send the list.`):i(t.channel.id,`Your list is too long to send it! Please install the [Split Large Messages](${g}) plugin.`):i(t.channel.id,d(a))}const G={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(e,t){const s=e.find(function(a){return a.name==="detailed"})?.value??!1;return q(s,t)},applicationId:"-1",inputType:1,type:1},H={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(e,t){const s=e.find(function(a){return a.name==="detailed"})?.value??!1;return z(s,t)},applicationId:"-1",inputType:1,type:1},J=T.findByStoreName("UserStore"),K={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(e,t){const s=(await J.getUser(e[0].value)).getAvatarURL(512),a=await U(s);return i(t.channel.id,a.url,t.message?.id)},applicationId:"-1",inputType:1,type:1},{FormSwitchRow:p,FormIcon:h,FormSection:w,FormDivider:Q}=$.Forms,y={List:c.getAssetIDByName("ic_list"),Message:c.getAssetIDByName("ic_message"),Copy:c.getAssetIDByName("ic_copy_message_link"),Info:c.getAssetIDByName("ic_info"),Theme:c.getAssetIDByName("ic_theme"),Plugin:c.getAssetIDByName("ic_plugins")};function X(){return _.useProxy(n.storage),n.storage.factSettings||(n.storage.factSettings={sendAsReply:!0,includeCitation:!1}),n.storage.listSettings||(n.storage.listSettings={pluginListAlwaysDetailed:!1,themeListAlwaysDetailed:!1}),React.createElement($.ErrorBoundary,null,React.createElement(F.ReactNative.ScrollView,{style:{flex:1}},React.createElement(w,{title:"Fact Commands",titleStyleType:"no_border"},React.createElement(p,{label:"Send as Reply",subLabel:"Send facts as a reply to the command message",leading:React.createElement(h,{source:y.Message}),onValueChange:function(e){n.storage.factSettings.sendAsReply=e},value:n.storage.factSettings.sendAsReply}),React.createElement(Q,null),React.createElement(p,{label:"Include Source Citation",subLabel:"Include the source of facts when available",leading:React.createElement(h,{source:y.Info}),onValueChange:function(e){n.storage.factSettings.includeCitation=e},value:n.storage.factSettings.includeCitation})),React.createElement(w,{title:"Plugin List",titleStyleType:"no_border"},React.createElement(p,{label:"Always Send Detailed List",subLabel:"Always use detailed mode when listing plugins",leading:React.createElement(h,{source:y.Plugin}),onValueChange:function(e){n.storage.listSettings.pluginListAlwaysDetailed=e},value:n.storage.listSettings.pluginListAlwaysDetailed})),React.createElement(w,{title:"Theme List",titleStyleType:"no_border"},React.createElement(p,{label:"Always Send Detailed List",subLabel:"Always use detailed mode when listing themes",leading:React.createElement(h,{source:y.Theme}),onValueChange:function(e){n.storage.listSettings.themeListAlwaysDetailed=e},value:n.storage.listSettings.themeListAlwaysDetailed}))))}n.storage.factSettings||(n.storage.factSettings={sendAsReply:!0,includeCitation:!1}),n.storage.listSettings||(n.storage.listSettings={pluginListAlwaysDetailed:!1,themeListAlwaysDetailed:!1});let C=[];var Z={onLoad:function(){console.log("[All-In-One Commands] Loading plugin..."),C=[l.registerCommand(V),l.registerCommand(k),l.registerCommand(W),l.registerCommand(K),l.registerCommand(G),l.registerCommand(H)],console.log("[All-In-One Commands] Plugin loaded successfully!")},onUnload:function(){console.log("[All-In-One Commands] Unloading plugin..."),C.forEach(function(e){return e()}),C=[],console.log("[All-In-One Commands] Plugin unloaded successfully!")},settings:X};return A.default=Z,Object.defineProperty(A,"__esModule",{value:!0}),A})({},vendetta.commands,vendetta.plugin,vendetta.metro,vendetta.themes,vendetta.plugins,vendetta.ui,vendetta.metro.common,vendetta.storage,vendetta.ui.assets,vendetta.ui.components);
|