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

Sharding and Quickmongo does not work together #445

Open Tomato6966 opened 2 years ago

Tomato6966 commented 2 years ago

My code is:

const { GiveawaysManager } = require('discord-giveaways');
const CustomGiveawayManager = class extends GiveawaysManager {
    async getAllGiveaways() {
        console.log("getAllGiveaways".bgGreen)
        return await client.giveawayDB.all(true);
    }
    async saveGiveaway(messageId, giveawayData) {
        await client.giveawayDB.set(messageId, giveawayData);
        return true;
    }
    async editGiveaway(messageId, giveawayData) {
        await client.giveawayDB.set(messageId, giveawayData);
        return true;
    }
    async deleteGiveaway(messageId) {
        await client.giveawayDB.delete(messageId);
        return true;
    }
    async refreshStorage() {
        console.log("refreshStorage".bgGreen)
        return client.cluster.broadcastEval(`this.giveawaysManager.getAllGiveaways()`);
    }
};
const manager = new CustomGiveawayManager(client, {
    default: {
        botsCanWin: false,
        embedColor: ee.color,
        embedColorEnd: ee.wrongcolor,
        reaction: '🎉'
    }
});
client.giveawaysManager = manager;

If i restart the bot after starting a giveaway getAllGiveaways is logged but never refreshStorage

  • After the restart, it's not ending the giveaway, however, if the bot stays online after starting the giveaway it will end it...
Tomato6966 commented 2 years ago

If I'm getting the db data with fetching directly from the mongodb (true) i receive this

but as you see it should have ended already image

Nico105 commented 2 years ago

refreshStorage isn't actually needed "anymore", you can remove it.

Tomato6966 commented 2 years ago

But it still doesnt "end"