Androz2091 / discord-giveaways

🎉 Complete framework to facilitate the creation of giveaways using discord.js
https://discord-giveaways.js.org
MIT License
335 stars 127 forks source link

Does not end giveaway on restart • Quickmongo #450

Closed Azer154 closed 2 years ago

Azer154 commented 2 years ago
db.on('ready', () => client.giveawaysManager._init());

const { GiveawaysManager } = require('discord-giveaways');
const GiveawayManagerWithOwnDatabase = class extends GiveawaysManager {

    async getAllGiveaways() {
        console.log('Done')
        return await db.all();
    }

    async saveGiveaway(messageId, giveawayData) {

        await db.set(messageId, giveawayData);

        console.log("SAVED")
        return true;
    }

    async editGiveaway(messageId, giveawayData) {

        await db.set(messageId, giveawayData);

        return true;
    }

    // This function is called when a giveaway needs to be deleted from the database.
    async deleteGiveaway(messageId) {

        await db.delete(messageId);

        return true;
    }
};

const manager = new GiveawayManagerWithOwnDatabase(client, {
    default: {
        botsCanWin: false,
        embedColor: '#FF0000',
        embedColorEnd: '#000000',
        reaction: '🎉'
    }
}, false); 

client.giveawaysManager = manager;

When I restart by bot, it doesn't end the giveaway I use quickmongo v5.1.2 discord-giveaways v5.1.1