Files
awesome-plugins/JavaScript/ownerOnly.js
github-actions[bot] 3ce312f5aa chore: Update JavaScript plugins (#89)
chore: update JavaScript plugins

Co-authored-by: jacoobes <jacoobes@users.noreply.github.com>
2023-04-29 12:06:58 -05:00

31 lines
940 B
JavaScript

// @ts-nocheck
/**
* This is OwnerOnly plugin, it allows only bot owners to run the command, like eval.
*
* @author @EvolutionX-10 [<@697795666373640213>]
* @version 1.1.0
* @example
* ```ts
* import { ownerOnly } from "../plugins/ownerOnly";
* import { commandModule } from "@sern/handler";
* export default commandModule({
* plugins: [ ownerOnly() ],
* execute: (ctx) => {
* //your code here
* }
* })
* ```
*/
import { CommandControlPlugin, controller } from "@sern/handler";
const ownerIDs = ["697795666373640213"]; //! Fill your ID
export function ownerOnly() {
return CommandControlPlugin(async (ctx, args) => {
if (ownerIDs.includes(ctx.user.id)) return controller.next(); //* If you want to reply when the command fails due to user not being owner, you can use following
// await ctx.reply("Only owner can run it!!!");
return controller.stop(); //! Important: It stops the execution of command!
});
}