refactor: pretty imports (#24)

This commit is contained in:
Evo
2022-10-03 21:02:54 +05:30
committed by GitHub
parent 1a5479ea41
commit e6581e6eba
23 changed files with 74 additions and 50 deletions

5
src/plugins/index.ts Normal file
View File

@@ -0,0 +1,5 @@
export * from "./channelOnly.js";
export * from "./cooldown.js";
export * from "./ownerOnly.js";
export * from "./publish.js";
export * from "./refreshCache.js";

View File

@@ -1,20 +1,18 @@
import { CommandType, EventPlugin, PluginType } from "@sern/handler";
export const ownerIDs = [
"697795666373640213",
"182326315813306368",
"756393473430519849",
];
import { ownerIDs } from "#constants";
export function ownerOnly(override?: string[]): EventPlugin<CommandType.Both> {
return {
type: PluginType.Event,
description: "Allows only bot owner to run command",
async execute(event, controller) {
const [ctx] = event;
if ((override ?? ownerIDs).includes(ctx.user.id)) return controller.next();
if ((override ?? ownerIDs).includes(ctx.user.id))
return controller.next();
await ctx.reply({
content: 'Not for you!',
ephemeral: true
})
content: "Not for you!",
ephemeral: true,
});
return controller.stop();
},
};