Home>

I want to make a command for random pictures, here I wrote the code, sends a link to the picture to the console, but not in the discord

const fetch= require ('node-fetch')
module.exports= {
  name: 'neko',
  category: 'utility',
  description: 'Send neko image',
  run: async (client, message, args)= >
 {
    const response= await fetch ('https://api.waifu.pics/sfw/neko', {
      method: 'GET',
      headers: {'image': 'application /json'}
    });
    const data= await response.json ();
console.log (data);
message.channel.send (data)
}
}

Version [email protected] [email protected]

  • Answer # 1

    It was necessary to register

    message.channel.send (data.url)
    
  • Answer # 2

    It was necessary to register

    message.channel.send (data.url)