From 5eaf9cbd99cac071546080ba758bab9fdec1b741 Mon Sep 17 00:00:00 2001 From: Win81VMUser Date: Sat, 19 Jul 2025 22:26:36 +0200 Subject: [PATCH] deploy: eda44314a5470486645e36f4e66f5e739f80cefd --- 404.md | 11 ++++++----- README.md | 11 ++++++----- messageScheduler/index.js | 4 ++-- messageScheduler/manifest.json | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/404.md b/404.md index c56f785..f972696 100644 --- a/404.md +++ b/404.md @@ -3,10 +3,11 @@ permalink: /404.html --- > **Note:** You accessed a link that returned a 404, probably by clicking one of the plugin links. You're supposed to copy the link address and add it into Vendetta. -# Vendetta Plugins Template -This repo contains a template for creating [Vendetta](https://github.com/vendetta-mod/Vendetta) plugins. +# Apex Plugins +This repo contains my own plugins for Revenge, mostly ports from [Vencore](https://github.com/ApexTeamPL/Vencore) # How to install? -Paste a plugin URL into the Plugins page of Vendetta, following a basic format of: - -https://`YOUR_GITHUB_USERNAME`.github.io/`REPO_NAME`/`PLUGIN_NAME` \ No newline at end of file +Paste a plugin URL into the Plugins page of Revenge, following a basic format of: +``` +https://raw.githubusercontent.com/ApexTeamPL/Apex-Plugins/refs/heads/gh-pages/ +``` diff --git a/README.md b/README.md index b3e2a25..c725317 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ -# Vendetta Plugins Template -This repo contains a template for creating [Vendetta](https://github.com/vendetta-mod/Vendetta) plugins. +# Apex Plugins +This repo contains my own plugins for Revenge, mostly ports from [Vencore](https://github.com/ApexTeamPL/Vencore) # How to install? -Paste a plugin URL into the Plugins page of Vendetta, following a basic format of: - -https://`YOUR_GITHUB_USERNAME`.github.io/`REPO_NAME`/`PLUGIN_NAME` \ No newline at end of file +Paste a plugin URL into the Plugins page of Revenge, following a basic format of: +``` +https://raw.githubusercontent.com/ApexTeamPL/Apex-Plugins/refs/heads/gh-pages/ +``` diff --git a/messageScheduler/index.js b/messageScheduler/index.js index a45af5f..a276bb3 100644 --- a/messageScheduler/index.js +++ b/messageScheduler/index.js @@ -1,3 +1,3 @@ -(function(h,c,B,p){"use strict";const w=p.findByProps("sendMessage","receiveMessage"),i=p.findByProps("sendBotMessage");let m={},g={},M,D,y;function C(n,s,t){const e=`${n}:${t}`,o=t-Date.now();return g[e]={content:s,at:t},m[e]=setTimeout(function(){const a=s;w.sendMessage(n,{content:a}),delete m[e],delete g[e],B.showToast("\u{1F4E4} Scheduled message sent.")},o),e}function v(){Object.values(m).forEach(clearTimeout),m={},g={}}function I(n){const s=new Date;n=n.toLowerCase();const t=/(\d+)(h|m|s)/g;let e=0,o;for(;(o=t.exec(n))!==null;){const d=parseInt(o[1]),r=o[2];r==="h"?e+=d*3600*1e3:r==="m"?e+=d*60*1e3:r==="s"&&(e+=d*1e3)}if(e>0)return Date.now()+e;const a=/^(\d{1,2}):(\d{2})(am|pm)?$/,u=n.match(a);if(u){let d=parseInt(u[1]);const r=parseInt(u[2]),f=u[3];f&&(f==="pm"&&d<12?d+=12:f==="am"&&d===12&&(d=0));const l=new Date(s);return l.setHours(d,r,0,0),l.getTime()<=s.getTime()&&l.setDate(l.getDate()+1),l.getTime()}return 0}function $(){M=c.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){const t=s.channel.id,e=n[0]?.value,o=n[1]?.value;if(typeof e!="string"||e.trim()==="")return i.sendBotMessage(t,"\u26D4 Invalid time value!");if(typeof o!="string"||o.trim()==="")return i.sendBotMessage(t,"\u26D4 Message cannot be empty!");const a=I(e);if(a===0||a<=Date.now())return i.sendBotMessage(t,"\u26D4 Invalid or past time specified!");C(t,o,a);const u=Math.round((a-Date.now())/1e3);i.sendBotMessage(t,`\u{1F553} Scheduled message in ${u}s.`)}}),D=c.registerCommand({name:"scheduled",displayName:"scheduled",description:"List scheduled messages",execute:function(n,s){const t=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?i.sendBotMessage(t,"No scheduled messages."):i.sendBotMessage(t,`Scheduled messages: +(function(h,c,D,p){"use strict";const w=p.findByProps("sendMessage","receiveMessage"),i=p.findByProps("sendBotMessage");let m={},g={},M,y,v;function C(n,s,t){const e=`${n}:${t}`,o=t-Date.now();return g[e]={content:s,at:t},m[e]=setTimeout(function(){const a=s;w.sendMessage(n,{content:a}),delete m[e],delete g[e],D.showToast("Scheduled message sent.")},o),e}function B(){Object.values(m).forEach(clearTimeout),m={},g={}}function I(n){const s=new Date;n=n.toLowerCase();const t=/(\d+)(h|m|s)/g;let e=0,o;for(;(o=t.exec(n))!==null;){const d=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)return Date.now()+e;const a=/^(\d{1,2}):(\d{2})(am|pm)?$/,r=n.match(a);if(r){let d=parseInt(r[1]);const u=parseInt(r[2]),f=r[3];f&&(f==="pm"&&d<12?d+=12:f==="am"&&d===12&&(d=0));const l=new Date(s);return l.setHours(d,u,0,0),l.getTime()<=s.getTime()&&l.setDate(l.getDate()+1),l.getTime()}return 0}function $(){M=c.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){const t=s.channel.id,e=n[0]?.value,o=n[1]?.value;if(typeof e!="string"||e.trim()==="")return i.sendBotMessage(t,"Invalid time value!");if(typeof o!="string"||o.trim()==="")return i.sendBotMessage(t,"Message cannot be empty!");const a=I(e);if(a===0||a<=Date.now())return i.sendBotMessage(t,"Invalid or past time specified!");C(t,o,a);const r=Math.round((a-Date.now())/1e3);i.sendBotMessage(t,`Scheduled message in ${r}s.`)}}),y=c.registerCommand({name:"scheduled",displayName:"scheduled",description:"List scheduled messages",execute:function(n,s){const t=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?i.sendBotMessage(t,"No scheduled messages."):i.sendBotMessage(t,`Scheduled messages: ${e.join(` -`)}`)}}),y=c.registerCommand({name:"cancel-scheduled",displayName:"cancel-scheduled",description:"Cancel all scheduled messages",execute:function(n,s){const t=s.channel.id;v(),i.sendBotMessage(t,"All scheduled messages cancelled.")}})}function T(){v(),c.unregisterCommand(M),c.unregisterCommand(D),c.unregisterCommand(y)}return h.onLoad=$,h.onUnload=T,h})({},vendetta.commands,vendetta.ui.toasts,vendetta.metro); +`)}`)}}),v=c.registerCommand({name:"cancel-scheduled",displayName:"cancel-scheduled",description:"Cancel all scheduled messages",execute:function(n,s){const t=s.channel.id;B(),i.sendBotMessage(t,"All scheduled messages cancelled.")}})}function T(){B(),c.unregisterCommand(M),c.unregisterCommand(y),c.unregisterCommand(v)}return h.onLoad=$,h.onUnload=T,h})({},vendetta.commands,vendetta.ui.toasts,vendetta.metro); diff --git a/messageScheduler/manifest.json b/messageScheduler/manifest.json index 4ac06c2..3fa9732 100644 --- a/messageScheduler/manifest.json +++ b/messageScheduler/manifest.json @@ -1 +1 @@ -{"name":"Message Scheduler","description":"Schedule messages to be sent at specific time or after a delay with /schedule.","authors":[{"name":"VMuser","id":"1258451646850007042"}],"main":"index.js","vendetta":{"icon":"ic_edit_24px"},"hash":"6d5ae8cb554883faca8aae1255458492b9a748e46498d0d30e3021ef775b7464"} \ No newline at end of file +{"name":"Message Scheduler","description":"Schedule messages to be sent at specific time or after a delay with /schedule.","authors":[{"name":"VMuser","id":"1258451646850007042"}],"main":"index.js","vendetta":{"icon":"ic_edit_24px"},"hash":"f5cf0020eaf8a6a9446440a9df6c248c23e68072c86606cc76d14e54b522f35d"} \ No newline at end of file