Discord bot已启动,但没有响应

时间:2020-07-07 14:58:49

标签: javascript node.js heroku discord.js

所以,我有这样的代码:

Sorry, the editor said too much code so I got to move it to codeshare.

机器人已启动,可以接收消息并登录到控制台,但是,Logged in!消息未登录到控制台,这意味着该机器人不是ready,尽管该机器人可以接收命令并将其记录到控制台,它不会执行任何响应。请参阅下面的日志:

2020-07-07T14:39:44.000000+00:00 app[api]: Build started by user *censored*
2020-07-07T14:40:01.359235+00:00 heroku[worker.1]: Restarting
2020-07-07T14:40:01.373843+00:00 heroku[worker.1]: State changed from up to starting
2020-07-07T14:40:01.188192+00:00 app[api]: Release v8 created by user *censored*
2020-07-07T14:40:01.188192+00:00 app[api]: Deploy 5ad6fb20 by user *censored*
2020-07-07T14:40:02.483212+00:00 heroku[worker.1]: Stopping all processes with SIGTERM
2020-07-07T14:40:02.587261+00:00 heroku[worker.1]: Process exited with status 143
2020-07-07T14:40:02.000000+00:00 app[api]: Build succeeded
2020-07-07T14:40:04.535781+00:00 heroku[worker.1]: Starting process with command `node .`
2020-07-07T14:40:05.339920+00:00 heroku[worker.1]: State changed from starting to up
2020-07-07T14:40:12.340512+00:00 app[worker.1]:  Iamnoot  nho :   about

这是不和谐窗口的屏幕截图:

error.png

编辑:Logged in!消息问题是因为client.once('Ready', () => {处的状态必须为ready:D

1 个答案:

答案 0 :(得分:1)

有很多可能性

  1. 您的前缀必须有一个空格,否则消息内容将是“关于”,然后将不符合条件。

(第3行,您声明了invite_link,所以为什么不将其第10行放在MessageEmbed中)

  1. 您的package.json中必须包含:
"scripts": {
    "start": "node (your file here)"
  },

第二个选项创建一个ProcFile文件,

node (your file here)

,然后转到heroku,部署更改并转到“资源” heroku

单击笔,然后启用工作程序,单击“保存”,通常它应该可以工作