vd-plugins/Commands/index.js

5 lines
13 KiB
JavaScript
Raw Normal View History

2025-09-27 21:46:26 +02:00
(function(E,O,a,d,T,g,u,o,B,V){"use strict";const W=d.findByProps("sendMessage"),c=function(t,n,s,e,i){if(!n)return{type:4};if(i)return{type:4,data:{content:n,flags:64}};const m={content:n,...s&&e?.factSettings?.sendAsReply?{messageReference:{messageId:s}}:{}};return W.sendMessage(t,m,void 0,{nonce:(Date.now()*4194304).toString()}),{type:4}},K=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}},G=async function(){return{text:(await(await fetch("https://dogapi.dog/api/v2/facts?limit=1")).json()).data[0].attributes.body}},U=async function(){const t=await(await fetch("https://catfact.ninja/fact")).json();return{text:t.fact,length:t.length}},_=async function(t){return await(await fetch(`https://api.obamabot.me/v2/image/petpet?image=${t.replace("webp","png")}`)).json()},R=function(t){let n=t.text;return a.storage.factSettings?.includeCitation&&t.source&&(n+=`
2025-09-27 19:17:53 +02:00
2025-09-27 21:46:26 +02:00
Source: ${t.source}`),n},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(t,n){const s=await U();return c(n.channel.id,R(s),n.message?.id,a.storage)}},z={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 s=await G();return c(n.channel.id,R(s),n.message?.id,a.storage)}},H={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 s=await K();return c(n.channel.id,R(s),n.message?.id,a.storage)}},y="https://vd-plugins.github.io/proxy/actuallythesun.github.io/vendetta-plugins/SplitLargeMessages/",r={ENABLED:"\u{1F7E2}",DISABLED:"\u{1F534}",SELECTED:"\u{1F536}",NOT_SELECTED:"\u{1F537}"},b=function(t){return t.map(function(n){return n.name}).join(", ")},p=function(t){return t.join(`
`).trimEnd()},A=function(t){return p(t).length},$=function(){return Object.keys(g.plugins).includes(y)},N=function(){return Object.values(g.plugins).find(function(t){return t.id===y})?.enabled??!1},x=function(){return u.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(){o.openURL(y)}})},k=function(){return u.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 t=Object.values(g.plugins).find(function(n){return n.id===y});t&&(t.enabled=!0)}})};async function Y(t,n){const s=a.storage.listSettings?.pluginListAlwaysDetailed??!1,e=[`**My Plugin List | ${Object.keys(g.plugins).length} Plugins**`,""];for(const i of Object.values(g.plugins)){const{enabled:m,manifest:C,id:D}=i,{name:S,description:w,authors:L}=C;t||s?e.push(`> **Name**: ${S}`,`> **Status**: ${m?r.ENABLED:r.DISABLED}`,`> **Description**: ${w}`,`> **Authors**: ${b(L)}`,`> **[Install!](${D})**`,""):e.push(`> ${m?r.ENABLED:r.DISABLED} **${S}** by ${b(L)}`)}return A(e)>2e3?$()?N()?u.alerts.showConfirmationAlert({title:"Large Message",content:"This list is over 2000 characters. Send anyway?",confirmText:"Send",cancelText:"Cancel",onConfirm:function(){return c(n.channel.id,p(e))}}):k():x():c(n.channel.id,p(e))}async function J(t,n){const s=a.storage.themeListAlwaysDetailed??!1,e=[`**My Theme List | ${Object.keys(T.themes).length} Themes**`,""],i=Object.values(T.themes);if(i.length)for(const m of i){const{selected:C,data:D,id:S}=m,{name:w,description:L,authors:j}=D;t||s?e.push(`> **Name**: ${w}`,`> **Selected**: ${C?r.SELECTED:r.NOT_SELECTED}`,`> **Description**: ${L}`,`> **Authors**: ${b(j)}`,`> **[Install!](${S})**`,""):e.push(`> ${C?r.SELECTED:r.NOT_SELECTED} **${w}** by ${b(j)}`)}else e.push("Nothing to see here, huh...");return A(e)>2e3?$()?N()?u.alerts.showConfirmationAlert({title:"Large Message",content:"This list is over 2000 characters. Send anyway?",confirmText:"Send",cancelText:"Cancel",onConfirm:function(){return c(n.channel.id,p(e))}}):k():x():c(n.channel.id,p(e))}const Q={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 s=t.find(function(e){return e.name==="detailed"})?.value??!1;return Y(s,n)},applicationId:"-1",inputType:1,type:1},X={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 s=t.find(function(e){return e.name==="detailed"})?.value??!1;return J(s,n)},applicationId:"-1",inputType:1,type:1},Z=d.findByStoreName("UserStore"),ee={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 s=(await Z.getUser(t[0].value)).getAvatarURL(512),e=await _(s);return c(n.channel.id,e.url,n.message?.id)},applicationId:"-1",inputType:1,type:1};d.findByProps("sendMessage");const I=d.findByProps("sendBotMessage","sendMessage","receiveMessage"),P=async function(t){const n="https://konachan.com/post.json",s=t?"rating:explicit":"rating:safe"