{ giphy.search("gifs", { q" /> { giphy.search("gifs", { q" /> { giphy.search("gifs", { q"/>

I can not find the error discord.js giphy/hug command

173 views Asked by At
const GphApiClient = require("giphy-js-sdk-core");
var giphy = GphApiClient ;
exports.run =  (bot, message, args, client) => {

giphy.search("gifs", { q: "fail" })
    .then(response => {
      var totalResponses = response.data.length;
      var responseIndex = Math.floor((Math.random() * 10) + 1) % totalResponses;
      var responseFinal = response.data[responseIndex]


 const embed = new Discord.RichEmbed() // Here is my problem it says 'Discord' is not defined
  .setAuthor('x')
  .setColor('RANDOM')
  .setTimestamp()
  .setDescription('')
  .setImage(responseFinal.images.fixed_height.url)        
  message.channel.send(embed)
}
)
}


exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: 0
};

exports.help = {
name: 'hug',
description: 'Free Hug!',
usage: 'hug'
};

I need help :c I just started to coding. I dont know what's the error it just says

'Discord' is not defined

If you find the error please dm me on discord. Wanheda#2722

1

There are 1 answers

0
Lauren Yim On

You need to require discord.js:

const Discord = require("discord.js");
// rest of code...

I dont know what's the error

The error is 'Discord' is not defined, which means that Node.js saw Discord in Discord.RichEmbed and tried to get its value, but there is no variable Discord.

See ReferenceError: "x" is not defined on MDN.