vd-plugins/Commands/index.js

5 lines
13 KiB
JavaScript
Raw Normal View History

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