izy521 / discord.io

A small, single-file library for creating DiscordApp clients from Node.js or the browser
https://discord.gg/0MvHMfHcTKVVmIGP
MIT License
535 stars 155 forks source link

GIF files cannot be uploaded #307

Closed Nico8400 closed 5 years ago

Nico8400 commented 5 years ago

When trying to upload a gif the bot won't do anything. Trying to upload a .png works fine. There's also no error in the logs. The part of the that handle this looks like this :

/*
Usual requires
*/

const MY_GIF = fs.readFileSync('./Path/To/Gif');
const MY_PNG  = fs.readFileSync('./Path/To/PNG');

/*
some code here
*/

bot.uploadFile( {
to: channelID,
file: MY_GIF,//Using MY_PNG will work
filename: "mygif.gif",
message: "Awesome gif here"
});

/*
Rest of the code
*/
Peacerekam commented 5 years ago

Try putting just the path in the "file" field. without the fs.readFileSync(). (same goes to the png file actually)

bot.uploadFile({
    to: channelID,
    file: "blush.gif"
})
SagnikPradhan commented 5 years ago

Add a Callback like :

bot.uploadFile({...},(err,res) => console.log(err))

And say what (if any) error is there?

Nico8400 commented 5 years ago

This is what I used before trying the method with FS and the results are the same. I cannot try it right now but I think that the gif file size might be the issue(I'm still able to share the gif myself tho). I will re-open the issue if it's not resolved by using a smaller gif.