简体   繁体   English

我找不到错误 discord.js giphy/hug 命令

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

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.我需要帮助:c 我刚开始编码。 I dont know what's the error it just says我不知道它刚刚说的错误是什么

'Discord' is not defined “不和谐”未定义

If you find the error please dm me on discord.如果您发现错误,请在 discord 上联系我。 Wanheda#2722万和达#2722

You need to require discord.js:您需要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 . 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 .请参阅ReferenceError: "x" is not defined on MDN

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Discord.js 拥抱命令如何 ping 消息作者和被拥抱的用户 - Discord.js hug command how to ping message author and user that gets hugged 我无法发送带有斜杠命令的嵌入 (discord.js) - I can't send an embed with a slash command (discord.js) 如何在我的 say 命令代码 discord.js 中修复此错误 - How can I fix this error in my say command code discord.js 我怎样才能使这个命令循环? [不和谐.js] - how can i make this command loop? [Discord.js] 无法使用 discord.js 获取带有 giphy 的 gif,制作机器人 - Cannot get gifs with giphy using discord.js, making a bot JavaScript: Discord.js !kick 命令出错 - JavaScript: Discord.js Error with !kick command Discord.js | 当我尝试运行我的 Discord.js 命令时,它会吐出错误“无法读取未定义的属性'执行'” - Discord.js | When I attempt to run my Discord.js command, it will spit out an error “Cannot read property 'execute' of undefined” 我怎样才能实现!leaveguild<guildid> 命令(离开指定的公会)进入我的 Discord (discord.js) 机器人?</guildid> - How can I implement a !leaveguild <guildID> command (that leaves the specified guild) into my Discord (discord.js) bot? Discord 命令没有执行我想要它执行的操作 - discord.js - Discord command not doing what I want it to do - discord.js 找不到 Discord 机器人的模块“discord.js” - Can't find module 'discord.js' for Discord bot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM