EmbedReferenceError:消息未定义

时间:2020-08-08 02:17:32

标签: javascript node.js discord discord.js

因此,我试图制造一个机器人,对此一无所知,因此我对该机器人进行了一些研究,并且一切正常,因此我尝试为其进行嵌入,我的意图是使它看起来像一个游戏个人资料中,我在https://www.codegrepper.com/code-examples/javascript/discord.js+embed+dm上看到了一个编码表,并将其填写在所需的布局中,但是"message.channel.send({embed: {", "ReferenceError: message is not defined"在尝试运行时不断弹出,我的代码是

{
    "content": "||__`ARCADIA`__|| ? ```js\nfunction foo(bar) {\n  console.log(bar);\n}\n\nfoo(1);```",
    "embed": {
     "title": "Profile",
     "description": " ```\nname```",
     "url": "https://discordapp.com",
     "color": 5301186,
     "timestamp": "2020-08-05T22:30:42.588Z",
       "footer": {
        "icon_url": "https://cdn.discordapp.com/emojis/738032536462163978.png?v=1/embed/avatars/0.png",
        "text": "An invitation to meet my blade"
       },
       "thumbnail": {
         "url": "https://cdn.discordapp.com/attachments/739919002121404446/740768912857104474/698661715742556200.png"
       },
       "image": {
         "url": "https://cdn.discordapp.com/attachments/739919002121404446/740029844926234744/Steward.Arknights.full.2929188.png"
       },
       "author": {
         "name": "author name",
         "url": "https://discordapp.com",
         "icon_url": "https://cdn.discordapp.com/attachments/739919002121404446/740769663260295198/2946824.jpg"
       },
       "fields": [
         {
           "name": "Level",
           "value": "100"
          },
          {
           "name": "Zells",
           "value": "1000000"
          },
          {
           "name": "Guild",
           "value": "Zen Rizor"
          },
          {
           "name": "SPIRT",
           "value": "Steward",
           "inline": true
          },
          {
           "name": "LEVEL",
           "value": "26",
           "inline": true
         }    
       ]
     }
   }
   

我还对原始代码进行了更改

1 个答案:

答案 0 :(得分:0)

您没有在使用它的地方声明任何message变量,而该错误是。