I am using sharp and would like to make a image editing discord bot. I need to use URLs for this of course so I tried that and saw a request function in the GitHub page. However, it doesn't seem to work for me. The error is in the title here is the code:
const Discord = require("discord.js")
const sharp = require("sharp")
const client = new Discord.Client()
const url = "https://934185.smushcdn.com/2425611/wp-content/uploads/2021/05/shiba-inu-2.jpeg"
async function startup() {
request({ url, encoding: null }, function(error, response, body) {
if (!error) {
sharp(body).rotate().resize(300, 300).toBuffer().then(function(data) {
console.log(data)
})
}
})
}
startup()
client.on("ready", () => {
console.log("Ready!")
})
client.login(process.env.token)