Answer the question
In order to leave comments, you need to log in
How to make Discord bot send images from google to chat?
I would like you to help write a script for the discord bot (in JavaScript). So that the bot searches for pictures in Google on request, takes a random image and sends it to the chat. I am not familiar with the language, I hope for your help.
Answer the question
In order to leave comments, you need to log in
https://www.npmjs.com/package/google-images
https://www.npmjs.com/package/free-google-image-search
Use one of these modules and search for an image. And then we make a random number (from zero to array.length - 1 (array - array)) and get an image from the array by the index of the number.
Hello soulOG, you can do it with this piece of code
With Embed:
if(message.content == 'Your command') {
const embed = new Discord.MessageEmbed()
.setTitle('Title')
.setColor(`Color `)
.setDescription('Description')
.setImage('Image link')
message.channel.send(embed);
}
Without Embed:
if(message.content == 'Your team') message.channel.send('Image link')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question