Closed KingCh1ll closed 3 years ago
What node version do you use? Does it happen without mongoose=default db?
Hi! I use node 14.15.5. I'm using the package QuickMongo.
Okay, still, does it happen if you comment your custom DB manager out? so we can check if it's because of quickmongo and was this only for 1 giveaway or have you started some more and did it happen there too?
Quick Question before I answer yours; Would it matter if my mongoose version is 5.11.15?
Here is my JavaScript for handling giveaways:
const { GiveawaysManager } = require("discord-giveaways")
module.exports = async (Bot) => {
class GiveawayManagerWithOwnDatabase extends GiveawaysManager {
async getAllGiveaways(){
return await Bot.Database.get("giveaways")
}
async saveGiveaway(MessageID, GiveawayData){
await Bot.Database.push("giveaways", GiveawayData)
return true
}
async editGiveaway(MessageID, NewGiveawayData){
const Giveaways = await Bot.Database.get("giveaways")
const NewGiveawaysArray = Giveaways.filter((giveaway) => giveaway.messageID !== MessageID)
NewGiveawaysArray.push(NewGiveawayData)
await Bot.Database.set("giveaways", NewGiveawaysArray)
return true
}
async deleteGiveaway(MessageID){
const Data = await Bot.Database.get("giveaways")
const NewGiveawaysArray = Data.filter((giveaway) => giveaway.messageID !== MessageID)
await Bot.Database.set("giveaways", NewGiveawaysArray)
return true
}
}
const Manager = new GiveawayManagerWithOwnDatabase(Bot, {
storage: false,
updateCountdownEvery: 10000,
default: {
botsCanWin: false,
exemptPermissions: ["MANAGE_MESSAGES"],
embedColor: Bot.Config.Embed.EmbedColor,
embedColorEnd: "#FF0000",
reaction: "🎉"
}
})
Bot.GiveawayManager = Manager
}
Would you like my command script?
and was this only for 1 giveaway or have you started some more and did it happen there too?
For each one I created this error appeared more & more. It's not a mongoose problem since it saves into mongoDB (as I can see).
Oh, I forgot I actually fixed this error for someone a time ago, I just didn't recognize it.
Remove storage: false
from your manager options, it's what causes the error
It will be removed from the examples in the next release.
Thank you so much for the help! I'm going to close this issue. Have a very nice day!
I just came across the npm package today. I set it up with MongoDB and made a test command for it. When the giveaway ended, instead of picking a winner it gave me this error:
Anyone know why this is happening?