From 2a444fd21d8a76f2c4127591177a9d04ddf6e0fe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 21 Sep 2022 06:38:51 +0530 Subject: [PATCH] chore: Update JavaScript plugins (#40) chore: update JavaScript plugins Co-authored-by: EvolutionX-10 --- JavaScript/disable.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 JavaScript/disable.js diff --git a/JavaScript/disable.js b/JavaScript/disable.js new file mode 100644 index 0000000..d180595 --- /dev/null +++ b/JavaScript/disable.js @@ -0,0 +1,34 @@ +// @ts-nocheck + +/** + * Disables a command entirely, for whatever reasons you may need. + * + * @author @jacoobes [<@182326315813306368>] + * @version 1.0.0 + * @example + * ```ts + * import { disable } from "../plugins/disable"; + * import { commandModule } from "@sern/handler"; + * export default commandModule({ + * plugins: [ disable() ], + * execute: (ctx) => { + * //your code here + * } + * }) + * ``` + */ +import { PluginType } from "@sern/handler"; +export function disable(onFail) { + return { + type: PluginType.Event, + description: "Disables command from responding", + + async execute([ctx], controller) { + if (onFail !== undefined) { + await ctx.reply(onFail); + } + + return controller.stop(); + }, + }; +}