Files
awesome-plugins/JavaScript/disable.js
github-actions[bot] 2a444fd21d chore: Update JavaScript plugins (#40)
chore: update JavaScript plugins

Co-authored-by: EvolutionX-10 <EvolutionX-10@users.noreply.github.com>
2022-09-21 06:38:51 +05:30

35 lines
713 B
JavaScript

// @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();
},
};
}