为什么我有这个错误。(node:16040) UnhandledPromiseRejectionWarning: TypeError.Canot read property 'title

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了为什么我有这个错误。(node:16040) UnhandledPromiseRejectionWarning: TypeError.Canot read property 'title相关的知识,希望对你有一定的参考价值。

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

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

const querystring = require('querystring');

module.export.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)
        })
}
答案

试试 embed.setTitle 或访问这个网站来定义它

https:/developer.mozilla.orgen-USdocsWebJavaScriptReferenceErrorsNot_defined。

以上是关于为什么我有这个错误。(node:16040) UnhandledPromiseRejectionWarning: TypeError.Canot read property 'title的主要内容,如果未能解决你的问题,请参考以下文章

用 NaN 替换 'UN' 表示的值

C++ 唯一指针;为啥这个示例代码会出现编译错误?错误代码太长了,我无法指定

c语言的 求这个用程序怎么写

Swift 3 un-flip 前置摄像头图片

在AD9中,编译原理图时出现un designated part 错误怎么改正呢

在AD9中,编译原理图时出现un designated part 错误怎么改正呢