From e617fdcefba3f12529284f0dd8f7b922cfa43587 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 14:12:24 +0530 Subject: [PATCH] chore: Update JavaScript plugins (#91) chore: update JavaScript plugins Co-authored-by: jacoobes --- JavaScript/ownerOnly.js | 11 ++++++----- TypeScript/ownerOnly.ts | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/JavaScript/ownerOnly.js b/JavaScript/ownerOnly.js index 68b10f1..03114f0 100644 --- a/JavaScript/ownerOnly.js +++ b/JavaScript/ownerOnly.js @@ -4,13 +4,13 @@ * This is OwnerOnly plugin, it allows only bot owners to run the command, like eval. * * @author @EvolutionX-10 [<@697795666373640213>] - * @version 1.1.0 + * @version 1.2.0 * @example * ```ts * import { ownerOnly } from "../plugins/ownerOnly"; * import { commandModule } from "@sern/handler"; * export default commandModule({ - * plugins: [ ownerOnly() ], + * plugins: [ ownerOnly() ], // can also pass array of IDs to override default owner IDs * execute: (ctx) => { * //your code here * } @@ -20,9 +20,10 @@ 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 +export function ownerOnly(override) { + return CommandControlPlugin((ctx) => { + if ((override ?? 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! diff --git a/TypeScript/ownerOnly.ts b/TypeScript/ownerOnly.ts index c6e9305..b73a96d 100644 --- a/TypeScript/ownerOnly.ts +++ b/TypeScript/ownerOnly.ts @@ -21,7 +21,8 @@ import { CommandType, CommandControlPlugin, controller } from "@sern/handler"; const ownerIDs = ["697795666373640213"]; //! Fill your ID export function ownerOnly(override?: string[]) { return CommandControlPlugin((ctx) => { - if ((override ?? ownerIDs).includes(ctx.user.id)) return controller.next(); + if ((override ?? 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!