-2
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'
};

我需要帮助:c 我刚开始编码。我不知道它刚刚说的错误是什么

“不和谐”未定义

如果您发现错误,请在 discord 上联系我。万和达#2722

4

1 回答 1

0

你需要requirediscord.js:

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

我不知道是什么错误

错误是'Discord' is not defined,这意味着 Node.js 看到DiscordDiscord.RichEmbed试图获取它的值,但是没有变量Discord

请参阅ReferenceError: "x" is not defined on MDN

于 2020-08-17T10:55:39.680 回答