Androz2091 / discord-giveaways

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

fillInEmbed: fix data source of embed #478

Closed kenmadev closed 1 year 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

Tomato6966 commented 1 year ago

do embed?.data ?? embed

ppl can then still provide raw api richembed data

Nico105 commented 1 year ago

Can you provide a step by step reproduce instruction for both of these issues? Cause I seem to do the wrong things for repro