mirror of
https://github.com/sern-handler/awesome-plugins
synced 2026-06-12 19:02:22 +00:00
chore: Update JavaScript plugins (#40)
chore: update JavaScript plugins Co-authored-by: EvolutionX-10 <EvolutionX-10@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a5d1f33fb1
commit
2a444fd21d
34
JavaScript/disable.js
Normal file
34
JavaScript/disable.js
Normal file
@@ -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();
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user