简体   繁体   English

为什么我有这个错误:(节点:16040)UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“标题”

[英]Why i"m having this error: (node:16040) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'title' of undefined

const Discord = require('discord.js') const riotapi = require('../botconfig.json') const Discord = require('discord.js') const riotapi = require('../botconfig.json')

const fetch = require("node-fetch"); const fetch = require("node-fetch");

const querystring = require('querystring');常量查询字符串 = 要求('查询字符串');

module.exports.run = async (client, message, args) => { const champ = args[0] module.exports.run = async (client, message, args) => { const champ = args[0]

    const Curl = `http://ddragon.leagueoflegends.com/cdn/10.11.1/data/pt_BR/champion/${champ}.json`
    const imgUrl = `http://ddragon.leagueoflegends.com/cdn/10.11.1/img/champion/${champ}.png`

    console.log(Curl)

    message.channel.send("Procurando pelo campeão: " + champ).then(message => message.delete({timeout: 1000}))

    fetch(Curl)
        .then(res => res.json())    
        .then(champS => {
            let champEmbed = new Discord.MessageEmbed()
            .setTitle(`${champ}`)
            .setDescription(`${champS.data.champ.title}`)
            .addField("Classe", `${champS.data.champ.tags}`)
            .addField("Dicas para aprimorar as fights!", `${champS.data.champ.enemytips}`)
            .addField("Dicas para ajudar o time!", `${champS.data.champ.allytips}`)
            .addField("Passiva", `${champS.data.champ.passive.description}`)
            .setThumbnail(imgUrl)
            .setColor("RED")
            .setFooter("Grandmaster, by: IgorDuca")

            message.channel.send(champEmbed)
        })
}

暂无
暂无

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

相关问题 UnhandledPromiseRejectionWarning: TypeError: 无法读取未定义的属性“title” - UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'title' of undefined 我有这个错误: UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'buffer' of undefined - I have this error: UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'buffer' of undefined 为什么我收到错误“UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'forEach' of undefined”? - Why am I getting the error “UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'forEach' of undefined”? (节点:7528)UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“确保” - (node:7528) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'ensure' of undefined (节点:10388)UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“缓存” - (node:10388) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'cache' of undefined (节点:6316)UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“id” - (node:6316) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined (节点:2724)UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“first” - (node:2724) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'first' of undefined (节点:47028)UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“表情符号” - (node:47028) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'emoji' of undefined (节点:152)UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“id” - (node:152) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined (节点:19677)UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“查找” - (node:19677) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'find' of undefined
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM