繁体   English   中英

“输入错误意外结束” - node.js discord 机器人

[英]“Unexpected End of Input Error” - node.js discord bot

我正在编辑一个工作文件以将我的机器人从使用嵌入消息更改为 webhook。 我整天都在与错误作斗争,最后只有一个要处理,但我不确定如何解决它。 以下代码是 src/core/send.js 的结尾,这是正在编辑的文件,但我得到 Unexpected End of Input Error 并且每当我尝试做某事时,它都会创建一个意外的令牌错误以替换为输入的结尾。 请帮忙!

代码可以在这里找到: https://github.com/ArtanisTheOne/TestingBot/blob/master/src/core/send.js代码:

            // Error if bot cannot write to dest
            //

            else
            {
               sendData.footer = null;
               sendData.embeds = null;
               sendData.color = "error";
               sendData.text =
                        ":no_entry:  Bot does not have permission to write at the " +
                        `<#${forwardChannel.id}> channel.`;

               return sendBox(sendData);
            }
         }

         //
         // Error on invalid forward channel
         //

         else
         {
            sendData.footer = null;
            sendData.embeds = null;
            sendData.color = "error";
            sendData.text = ":warning:  Invalid channel.";
            return sendBox(sendData);
         }
      }

      if (data.author)
      {
         sendData.author = data.author;
      }
   };

   return sendBox(sendData);
         }
});

我正在编辑一个工作文件以将我的机器人从使用嵌入消息更改为 webhook。 我整天都在与错误作斗争,最后只有一个要处理,但我不确定如何解决它。 以下代码是 src/core/send.js 的结尾,这是正在编辑的文件,但我得到 Unexpected End of Input Error 并且每当我尝试做某事时,它都会创建一个意外的令牌错误以替换为输入的结尾。 请帮忙!

代码可以在这里找到: https://github.com/ArtanisTheOne/TestingBot/blob/master/src/core/send.js代码:

            // Error if bot cannot write to dest
            //

            else
            {
               sendData.footer = null;
               sendData.embeds = null;
               sendData.color = "error";
               sendData.text =
                        ":no_entry:  Bot does not have permission to write at the " +
                        `<#${forwardChannel.id}> channel.`;

               return sendBox(sendData);
            }
         }

         //
         // Error on invalid forward channel
         //

         else
         {
            sendData.footer = null;
            sendData.embeds = null;
            sendData.color = "error";
            sendData.text = ":warning:  Invalid channel.";
            return sendBox(sendData);
         }
      }

      if (data.author)
      {
         sendData.author = data.author;
      }
   };

   return sendBox(sendData);
         }
});

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM