From ff401820080637a5b039e4024a8377ab55c30801 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 25 Feb 2023 14:31:22 +0530 Subject: [PATCH] chore: Update JavaScript plugins (#86) chore: update JavaScript plugins Co-authored-by: EvolutionX-10 --- JavaScript/buttonConfirmation.js | 2 +- JavaScript/disable.js | 51 +++++++-- pluginlist.json | 190 ++++++++++++++++++------------- 3 files changed, 150 insertions(+), 93 deletions(-) diff --git a/JavaScript/buttonConfirmation.js b/JavaScript/buttonConfirmation.js index afd925e..d8b4b3e 100644 --- a/JavaScript/buttonConfirmation.js +++ b/JavaScript/buttonConfirmation.js @@ -26,7 +26,7 @@ import { ButtonStyle, ComponentType, } from "discord.js"; -export function confirmation(options) { +export function buttonConfirmation(options) { return CommandControlPlugin(async (ctx, args) => { options = { content: "Do you want to proceed?", diff --git a/JavaScript/disable.js b/JavaScript/disable.js index d180595..78f52de 100644 --- a/JavaScript/disable.js +++ b/JavaScript/disable.js @@ -4,7 +4,8 @@ * Disables a command entirely, for whatever reasons you may need. * * @author @jacoobes [<@182326315813306368>] - * @version 1.0.0 + * @author @Peter-MJ-Parker [<@1017182455926624316>] + * @version 2.0.0 * @example * ```ts * import { disable } from "../plugins/disable"; @@ -17,18 +18,46 @@ * }) * ``` */ -import { PluginType } from "@sern/handler"; +import { CommandControlPlugin, controller } from "@sern/handler"; export function disable(onFail) { - return { - type: PluginType.Event, - description: "Disables command from responding", + return CommandControlPlugin(async (ctx, [args]) => { + if (onFail !== undefined) { + switch (args) { + case "text": + //reply to text command + const msg = await ctx.reply(onFail); + setTimeout(() => { + //deletes the bots reply to the user + msg.delete(); //deletes the original authors message (text command). - async execute([ctx], controller) { - if (onFail !== undefined) { - await ctx.reply(onFail); + ctx.message.delete(); //waits 5 seconds before deleting messages + }, 5000).catch((e) => { + //logs error to console (if any). + console.log(e); + }); + break; + + case "slash": + //ephemeral response to say the command is disabled with users response. + await ctx.reply({ + content: onFail, + ephemeral: true, + }); + break; + + default: + break; } + } //this function tells the bot to reply to an interaction so it doesn't seem like it fails (in case there is no onFail message). - return controller.stop(); - }, - }; + if (onFail === undefined && args === "slash") { + onFail = "This command is disabled."; + await ctx.reply({ + content: onFail, + ephemeral: true, + }); + } //stop the command from running + + return controller.stop(); + }); } diff --git a/pluginlist.json b/pluginlist.json index 398adf7..d3e3003 100644 --- a/pluginlist.json +++ b/pluginlist.json @@ -1,82 +1,110 @@ { - "JavaScript" : [ { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/publish.js", - "name" : "publish" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/buttonConfirmation.js", - "name" : "buttonConfirmation" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/requirePermission.js", - "name" : "requirePermission" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/nsfwOnly.js", - "name" : "nsfwOnly" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/serverOnly.js", - "name" : "serverOnly" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/ownerOnly.js", - "name" : "ownerOnly" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/confirmation.js", - "name" : "confirmation" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/permCheck.js", - "name" : "permCheck" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/dmOnly.js", - "name" : "dmOnly" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/disable.js", - "name" : "disable" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/channelType.js", - "name" : "channelType" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/assertFields.js", - "name" : "assertFields" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/cooldown.js", - "name" : "cooldown" - } ], - "TypeScript" : [ { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/permCheck.ts", - "name" : "permCheck" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/assertFields.ts", - "name" : "assertFields" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/serverOnly.ts", - "name" : "serverOnly" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/dmOnly.ts", - "name" : "dmOnly" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/disable.ts", - "name" : "disable" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/publish.ts", - "name" : "publish" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/cooldown.ts", - "name" : "cooldown" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/confirmation.ts", - "name" : "confirmation" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/ownerOnly.ts", - "name" : "ownerOnly" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/channelType.ts", - "name" : "channelType" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/nsfwOnly.ts", - "name" : "nsfwOnly" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/requirePermission.ts", - "name" : "requirePermission" - }, { - "link" : "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/buttonConfirmation.ts", - "name" : "buttonConfirmation" - } ] -} \ No newline at end of file + "JavaScript": [ + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/publish.js", + "name": "publish" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/buttonConfirmation.js", + "name": "buttonConfirmation" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/requirePermission.js", + "name": "requirePermission" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/nsfwOnly.js", + "name": "nsfwOnly" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/serverOnly.js", + "name": "serverOnly" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/ownerOnly.js", + "name": "ownerOnly" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/confirmation.js", + "name": "confirmation" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/permCheck.js", + "name": "permCheck" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/dmOnly.js", + "name": "dmOnly" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/disable.js", + "name": "disable" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/channelType.js", + "name": "channelType" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/assertFields.js", + "name": "assertFields" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/JavaScript/cooldown.js", + "name": "cooldown" + } + ], + "TypeScript": [ + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/permCheck.ts", + "name": "permCheck" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/assertFields.ts", + "name": "assertFields" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/serverOnly.ts", + "name": "serverOnly" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/dmOnly.ts", + "name": "dmOnly" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/disable.ts", + "name": "disable" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/publish.ts", + "name": "publish" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/cooldown.ts", + "name": "cooldown" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/confirmation.ts", + "name": "confirmation" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/ownerOnly.ts", + "name": "ownerOnly" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/channelType.ts", + "name": "channelType" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/nsfwOnly.ts", + "name": "nsfwOnly" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/requirePermission.ts", + "name": "requirePermission" + }, + { + "link": "https://raw.githubusercontent.com/sern-handler/awesome-plugins/main/TypeScript/buttonConfirmation.ts", + "name": "buttonConfirmation" + } + ] +}