AKORA-Studios / DiscordWelcomeCard

Discord Welcome Card
MIT License
19 stars 6 forks source link

Unsupported Image Type error that the Canvas module is throwing #55

Closed EntropicBlackhole closed 1 year ago

EntropicBlackhole commented 2 years ago

Describe the bug There's an error when loading a certain picture (The background it seems, I used one of the default ones: Circuit), this is not an external image though, the error comes directly from the canvas npm module

To Reproduce I simply copied the code in the homepage,

if (message.content == '$test') {
    let image = await welcomeImage(message.member, { theme: 'circuit' })
    // fs.writeFileSync('./test.png', image)
    message.channel.send({ files: [new Discord.AttachmentBuilder(image)] })
    return
}

I'm using discord.js v14 if that helps, I don't think this would cause the error since Canvas throws an unsupported image type error

Error:

node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: Unsupported image type
    at setSource (C:\Users\aschr\Dropbox\Coding\Javascript\entropic_bot\node_modules\canvas\lib\image.js:94:13)
    at C:\Users\aschr\Dropbox\Coding\Javascript\entropic_bot\node_modules\canvas\lib\image.js:62:11
    at C:\Users\aschr\Dropbox\Coding\Javascript\entropic_bot\node_modules\simple-get\index.js:97:7
    at IncomingMessage.<anonymous> (C:\Users\aschr\Dropbox\Coding\Javascript\entropic_bot\node_modules\simple-concat\index.js:8:13)

The Machine the script is running on (please complete the following information):

EntropicBlackhole commented 2 years ago

Okay so after some testing, turns out that message.author.displayAvatarURL({ format: 'png' }) does not work for discord.js v14, as it's now Guild Members who would do that in this case, doing message.member.displayAvatarURL({ extension: 'png' }) would work now, also it's currently throwing that LinearGradient isn't a constructor error for some reason

A-K-O-R-A commented 1 year ago

This issue is fixed with Version v4.9.0