(function(h,r,w,p){"use strict";constB=p.findByProps("sendMessage","receiveMessage"),c=p.findByProps("sendBotMessage");letm={},g={},M,y,v;functionC(n,s,t){conste=`${n}:${t}`,o=t-Date.now();returng[e]={content:s,at:t},m[e]=setTimeout(function(){consta=s,i=Date.now().toString();B.sendMessage(n,{content:a},void0,{nonce:i}),deletem[e],deleteg[e],w.showToast("Scheduled message sent.")},o),e}functionD(){Object.values(m).forEach(clearTimeout),m={},g={}}functionI(n){consts=newDate;n=n.toLowerCase();constt=/(\d+)(h|m|s)/g;lete=0,o;for(;(o=t.exec(n))!==null;){constd=parseInt(o[1]),u=o[2];u==="h"?e+=d*3600*1e3:u==="m"?e+=d*60*1e3:u==="s"&&(e+=d*1e3)}if(e>0)returnDate.now()+e;consta=/^(\d{1,2}):(\d{2})(am|pm)?$/,i=n.match(a);if(i){letd=parseInt(i[1]);constu=parseInt(i[2]),f=i[3];f&&(f==="pm"&&d<12?d+=12:f==="am"&&d===12&&(d=0));constl=newDate(s);returnl.setHours(d,u,0,0),l.getTime()<=s.getTime()&&l.setDate(l.getDate()+1),l.getTime()}return0}function$(){M=r.registerCommand({name:"schedule",displayName:"schedule",description:"Schedule a message after a delay or at a time",options:[{name:"time",description:"Delay (e.g. 10s, 1h30m) or time (3:30pm, 15:30)",type:3,required:!0},{name:"message",description:"Message to send",type:3,required:!0}],execute:function(n,s){constt=s.channel.id,e=n[0]?.value,o=n[1]?.value;if(typeofe!="string"||e.trim()==="")returnc.sendBotMessage(t,"Invalid time value!");if(typeofo!="string"||o.trim()==="")returnc.sendBotMessage(t,"Message cannot be empty!");consta=I(e);if(a===0||a<=Date.now())returnc.sendBotMessage(t,"Invalid or past time specified!");C(t,o,a);consti=Math.round((a-Date.now())/1e3);c.sendBotMessage(t,`Scheduled message in ${i}s.`)}}),y=r.registerCommand({name:"scheduled",displayName:"scheduled",description:"List scheduled messages",execute:function(n,s){constt=s.channel.id,e=Object.entries(g).map(function([o,a]){return`\u2022 **In ${Math.round((a.at-Date.now())/1e3)}s** \u2192 ${a.content}`});e.length===0?c.sendBotMessage(t,"No scheduled messages."):c.sendBotMessage(t,`Scheduled messages: