From f98ab375838b1720946b8ed43393b0668a54183d Mon Sep 17 00:00:00 2001 From: SrIzan10 <66965250+SrIzan10@users.noreply.github.com> Date: Thu, 29 Dec 2022 23:30:44 +0100 Subject: [PATCH] feat: some db prep --- .gitignore | 3 ++- events/djs/ready.ts | 2 +- schemas/disable.ts | 38 ++++++++++++++++++++++++++++++++++++++ schemas/pepega.ts | 11 +++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 schemas/disable.ts create mode 100644 schemas/pepega.ts diff --git a/.gitignore b/.gitignore index c7fb7a4..13fbbfc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /node_modules /dist -.env \ No newline at end of file +.env +commands/lol/ \ No newline at end of file diff --git a/events/djs/ready.ts b/events/djs/ready.ts index 649437c..2865475 100644 --- a/events/djs/ready.ts +++ b/events/djs/ready.ts @@ -3,7 +3,7 @@ import { Client } from "discord.js"; export default eventModule({ type: EventType.Discord, - execute: async (client: Client) => { + execute: async () => { console.log('el bot c ha ensendio'); }, }); \ No newline at end of file diff --git a/schemas/disable.ts b/schemas/disable.ts new file mode 100644 index 0000000..5fc2f1f --- /dev/null +++ b/schemas/disable.ts @@ -0,0 +1,38 @@ +// @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 { CommandType, EventPlugin, PluginType } from "@sern/handler"; +import { InteractionReplyOptions, ReplyMessageOptions } from "discord.js"; + +export function disable( + onFail?: + | string + | Omit + | ReplyMessageOptions +): EventPlugin { + return { + type: PluginType.Event, + description: "Disables command from responding", + async execute([ctx], controller) { + if (onFail !== undefined) { + await ctx.reply(onFail); + } + return controller.stop(); + }, + }; +} diff --git a/schemas/pepega.ts b/schemas/pepega.ts new file mode 100644 index 0000000..8639d9c --- /dev/null +++ b/schemas/pepega.ts @@ -0,0 +1,11 @@ +import { model, Schema } from "mongoose"; + +const schema = new Schema({ + userid: {type: String, required: true}, + times: {type: Number, required: true} +}) + +// @ts-ignore +const db = new model('pepega', schema) + +export default db; \ No newline at end of file