From 43e22b4bc2f02dc0ce51c717436c7bb875209acd Mon Sep 17 00:00:00 2001 From: SrIzan10 <66965250+SrIzan10@users.noreply.github.com> Date: Tue, 18 Oct 2022 20:07:07 +0200 Subject: [PATCH] chore: we add a lil button --- commands/misc/credits.ts | 4 ++++ src/plugins/srIzanOnly.ts | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/plugins/srIzanOnly.ts diff --git a/commands/misc/credits.ts b/commands/misc/credits.ts index 7965080..8c75dff 100644 --- a/commands/misc/credits.ts +++ b/commands/misc/credits.ts @@ -38,6 +38,10 @@ export default commandModule({ new ButtonBuilder() .setLabel('lol') .setURL('https://discord.com/channels/928018226330337280/928018227156643857/1030480463690731530') + .setStyle(ButtonStyle.Link), + new ButtonBuilder() + .setLabel('<3') + .setURL('https://discord.com/channels/928018226330337280/1030913456846680134') .setStyle(ButtonStyle.Link) ) await ctx.reply({embeds: [page1], components: [buttons], ephemeral: true}) diff --git a/src/plugins/srIzanOnly.ts b/src/plugins/srIzanOnly.ts new file mode 100644 index 0000000..c0a29be --- /dev/null +++ b/src/plugins/srIzanOnly.ts @@ -0,0 +1,31 @@ +// @ts-nocheck +/** + * @author: @EvolutionX-10 + * @version: 1.0.0 + * @description: This is OwnerOnly plugin, it allows only bot owners to run the command, like eval. + * @license: MIT + * @example: + * ```ts + * import { OwnerOnly } from "../path/to/your/plugin/folder"; + * import { sernModule, CommandType } from "@sern/handler"; + * export default sernModule([OwnerOnly()], { + * // your code + * }) + * ``` + */ + +import { CommandType, EventPlugin, PluginType } from "@sern/handler"; +const ownerIDs = ['703974042700611634']; //! Fill your ID +export function ownerOnly(): EventPlugin { + return { + type: PluginType.Event, + description: "Allows only bot owner to run command", + async execute(event, controller) { + const [ctx] = event; + 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("**ERROR**: Sólo Sr Izan puede correr este comando."); + return controller.stop(); //! Important: It stops the execution of command! + }, + }; +}