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

fillInEmbed: fix data source of embed #477

Closed kenmadev closed 2 years ago

kenmadev commented 2 years ago

Changes

Since we shifted using discordjs v14, EmbedBuilder uses a data property to access the properties of the embed. The Discord.EmbedBuilder.from method accepts the same parameter with APIEmbed interface but we're currently passing the embed instance to the said function, this results to have a redundant data property. Giving {data: {data:{}}} structure. It happens when we pull data from a database.

When a giveaway ended. The line https://github.com/Androz2091/discord-giveaways/blob/master/src/Giveaway.js#L751 throws an error. Because the description is null coming from https://github.com/Androz2091/discord-giveaways/blob/master/src/Giveaway.js#L745-L746. Again it only happens when pulling the giveaway from DB where the timer runs out but has not ended.

Status