Closed futurepirateking closed 7 years ago
Hey @kobeissi2. The giphy-api
module returns the actual response from the official Giphy API. Take a look here for an example response. The Giphy search response returns 25 images by default in its response, so what you're going to receive is an array.
giphy.search('pokemon').then(function (res) {
// Print the url of the first image returned in the array
console.log(res.data[0].images.original.url);
});
If you're only interested in single result, you can add the limit
option:
giphy.search({
q: 'pokemon',
limit: 1 // The response will contain an array of length 1
}).then(function (res) {
// Print the url of the first image returned in the array
console.log(res.data[0].images.original.url);
});
Let me know if you have any other questions.
Thank you!
giphy.search('pokemon').then(function (res) { // Res contains gif data! });
I'm trying to use this in my discord.js bot but i'm not sure how i'm supposed to get the image.
I've tried message.channel.send(res[0]) and it doesn't do anything.