vd-plugins/Commands/index.js

5 lines
16 KiB
JavaScript
Raw Normal View History

2025-09-27 23:25:16 +02:00
(function(R,q,s,m,A,C,b,i,K,G){"use strict";const U=m.findByProps("sendMessage"),g=function(n,t,a,e,o){if(!t)return{type:4};if(o)return{type:4,data:{content:t,flags:64}};const c={content:t,...a&&e?.factSettings?.sendAsReply?{messageReference:{messageId:a}}:{}};return U.sendMessage(n,c,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()},v=function(n){let t=n.text;return s.storage.factSettings?.includeCitation&&n.source&&(t+=`
2025-09-27 19:17:53 +02:00
2025-09-27 23:25:16 +02:00
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 g(t.channel.id,v(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 g(t.channel.id,v(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 g(t.channel.id,v(a),t.message?.id,s.storage)}},L="https://vd-plugins.github.io/proxy/actuallythesun.github.io/vendetta-plugins/SplitLargeMessages/",p={ENABLED:"\u{1F7E2}",DISABLED:"\u{1F534}",SELECTED:"\u{1F536}",NOT_SELECTED:"\u{1F537}"},$=function(n){return n.map(function(t){return t.name}).join(", ")},w=function(n){return n.join(`
`).trimEnd()},N=function(n){return w(n).length},M=function(){return Object.keys(C.plugins).includes(L)},x=function(){return Object.values(C.plugins).find(function(n){return n.id===L})?.enabled??!1},k=function(){return b.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(L)}})},P=function(){return b.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(C.plugins).find(function(t){return t.id===L});n&&(n.enabled=!0)}})};async function ee(n,t){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:c,manifest:u,id:f}=o,{name:h,description:r,authors:l}=u;n||a?e.push(`> **Name**: ${h}`,`> **Status**: ${c?p.ENABLED:p.DISABLED}`,`> **Description**: ${r}`,`> **Authors**: ${$(l)}`,`> **[Install!](${f})**`,""):e.push(`> ${c?p.ENABLED:p.DISABLED} **${h}** by ${$(l)}`)}return N(e)>2e3?M()?x()?b.alerts.showConfirmationAlert({title:"Large Message",content:"This list is over 2000 characters. Send anyway?",confirmText:"Send",cancelText:"Cancel",onConfirm:function(){return g(t.channel.id,w(e))}}):P():k():g(t.channel.id,w(e))}async function te(n,t){const a=s.storage.themeListAlwaysDetailed??!1,e=[`**My Theme List | ${Object.keys(A.themes).length} Themes**`,""],o=Object.values(A.themes);if(o.length)for(const c of o){const{selected:u,data:f,id:h}=c,{name:r,description:l,authors:W}=f;n||a?e.push(`> **Name**: ${r}`,`> **Selected**: ${u?p.SELECTED:p.NOT_SELECTED}`,`> **Description**: ${l}`,`> **Authors**: ${$(W)}`,`> **[Install!](${h})**`,""):e.push(`> ${u?p.SELECTED:p.NOT_SELECTED} **${r}** by ${$(W)}`)}else e.push("Nothing to see here, huh...");return N(e)>2e3?M()?x()?b.alerts.showConfirmationAlert({title:"Large Message",content:"This list is over 2000 characters. Send anyway?",confirmText:"Send",cancelText:"Cancel",onConfirm:function(){return g(t.channel.id,w(e))}}):P():k():g(t.channel.id,w(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=m.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 g(t.channel.id,e.url,t.message?.id)},applicationId:"-1",inputType:1,type:1},I=m.findByProps("sendMessage"),B=m.findByProps("sendBotMessage","sendMessage","receiveMessage"),F=async function(n){const t="https://konachan.com/post.json",a=n?"rating:explicit":"rating:s