feat: some db prep

This commit is contained in:
2022-12-29 23:30:44 +01:00
parent 7342b58e6e
commit f98ab37583
4 changed files with 52 additions and 2 deletions

3
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/node_modules
/dist
.env
.env
commands/lol/

View File

@@ -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');
},
});

38
schemas/disable.ts Normal file
View File

@@ -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<InteractionReplyOptions, "fetchReply">
| ReplyMessageOptions
): EventPlugin<CommandType.Both> {
return {
type: PluginType.Event,
description: "Disables command from responding",
async execute([ctx], controller) {
if (onFail !== undefined) {
await ctx.reply(onFail);
}
return controller.stop();
},
};
}

11
schemas/pepega.ts Normal file
View File

@@ -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;