revoltchat / revolt.js

Modern Typescript library for interacting with Revolt.
https://revolt.js.org
MIT License
216 stars 54 forks source link

bug: TextEmbed not working #95

Open kenyonbowers opened 2 months ago

kenyonbowers commented 2 months ago

What happened?

My code is this:

const embed = new TextEmbed(new MessageEmbed({ title: "Too many verse references!", description: "There are too many verse references in your message." }))

Yet, I keep getting this error:

TypeError: Cannot read properties of undefined (reading 'icon_url')
    at new TextEmbed (D:\Repos\KJV-Bot-Revolt\node_modules\revolt.js\lib\cjs\classes\MessageEmbed.js:166:28)
    at Object.execute (D:\Repos\KJV-Bot-Revolt\src\events\client\messageCreate.js:14:39)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

I have tried putting a value icon_url in the TextEmbed, and even gave a valid image url, yet it keeps giving me the exact same error. I also tried putting it as iconUrl to see if that worked, and it didn't.

austinhuang0131 commented 4 weeks ago

The icon_url needs to be in the initiator of MessageEmbed. See

https://github.com/revoltchat/revolt.js/blob/929d1bc0696f125748ccd9302b75ee4e8a1a1c8c/src/classes/MessageEmbed.ts#L218