const { Listener } = require('@sapphire/framework'); const { EmbedBuilder } = require("discord.js"); const { color, emojis } = require('../config'); const { GiveawaysManager: gw } = require('discord-giveaways'); const giveawaySchema = require('../lib/schemas/giveawaySchema'); class UserEvent extends Listener { constructor(context, options = {}) { super(context, { ...options, event: 'messageCreate', once: false }); } async run (message) { module.exports = class GiveawaysManager extends gw { async getAllGiveaways() { return await giveawaySchema.find().lean().exec(); } async saveGiveaway(giveawayData) { return await giveawaySchema.create(giveawayData); } async editGiveaway(messageId, giveawayData) { return await giveawaySchema.updateOne({ messageId }, giveawayData, { omitUndefined: true }).exec(); } async deleteGiveaway(messageId) { return await giveawaySchema.deleteOne({ messageId }).exec(); } }; } }; module.exports = { UserEvent };