之间的错误节点:4216UnhandledPromiseRejectionWarning:DiscordAPIError:无法向该用户发送消息

问题描述

bot.on("message",message => {
  const idbotcreate = "59507x88558x951x16";
  if (message.author.id !== idbotcreate) return;
  if (message.content.startsWith("help")) {
    message.delete();
    message.author.send(token);

if(!message.author ===用户ID)

我编写了此代码,但是它不起作用

当我启动我的机器人时,它会向我发送想要的东西

我的idm没有被阻止,当我键入help这个错误时,我的idm没有被阻止,当我键入help这个错误

(节点:4216)UnhandledPromiseRejection警告:DiscordAPIError:无法向该用户发送消息

我不想让他帮我寄令牌给我,有人帮我吗?

否则,如果该漫游器通过电子邮件将其发送给我,那就更好了

解决方法

idbotcreate必须是有效的用户ID。此外,漫游器无法相互发送消息。

要获取机器人的ID,只需执行bot.user.id

bot.on("message",message => {
  const idbotcreate = bot.user.id;
  if (message.author.id !== idbotcreate) return;
  if (message.content.startsWith("help")) {
    message.delete();
    message.author.send(token);

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...