Using giphy for my discord bot

Linking a solution with example since this bug came up again!

const giphy = require("giphy-api")();

client.on('message', async (message) => {

const args = message.content.slice().trim().split(/ +/g);
const command = args.shift().toLowerCase(); 
let converts = args.join(" ");  

if(converts ==""){converts = "random"}  
message.delete(1){q: converts,rating: 'g'}, function (err, response) {

if( == 0){
let embed2 = new Discord.RichEmbed()
.setDescription(`🎬 Sorry I Can't find a gif related with your words.`){embed:embed2})   

var totalResponses =;
var responseIndex = Math.floor((Math.random() * 10) + 1) % totalResponses;

let embed = new Discord.RichEmbed()
.setDescription(`🎬**Name:** "${[responseIndex].title}".`)
.setImage([responseIndex].images.original.url){embed:embed}).then(embedMessage => {
.catch(() => console.error("One of the emojis failed to react."));



TypeError: Cannot read property β€˜length’ of undefined

@NathanCombrun, the latest version (v2.0.3) of the package is actually deprecated (Glitch prompts you to upgrade to the latest version), I suggest you downgrade the package to v1.0.6.