eval 命令根本不起作用,但不会报错

Eval command doesn't work at all, but it doesn't error

我正在尝试为我的机器人创建一个 eval 命令。它不会出错,但不会向控制台或不和谐频道发送消息。这是我的评估代码:

const clean = async (client, text) => {
  if (text && text.constructor.name == "Promise")
    text = await text;
  if (typeof text !== "string")
    text = require("util").inspect(text, { depth: 1 });
  text = text
    .replace(/`/g, "`" + String.fromCharCode(8203))
      .replace(/@/g, "@" + String.fromCharCode(8203));
  text = text.replaceAll(client.token, "[REDACTED]");
  return text;
}

client.on("messageCreate", async (message) => {
  const args = message.content.split(" ").slice(1);

  if (message.content.startsWith(`${p}eval`)) {
    if (message.author.id !== 821682594830614578) {
      return;
    }
    
    try {
      const evaled = eval(args.join(" "));
      const cleaned = await clean(client, evaled);

      message.channel.send(`\`\`\`js\n${cleaned}\n\`\`\``);
    } catch (err) {
      message.channel.send(`\`ERROR\` \`\`\`xl\n${cleaned}\n\`\`\``);
    }

  }

});

如果需要我提供更多代码,请告诉我。

可能是您的 Discord ID 有误。告诉我你的discord用户名,我加你为好友,私信解决。

这是我的 Discord 用户名 Nishant1500#9735

你似乎把一个数字作为你的 ID...Discord.jsID 是字符串,所以你应该把你的 ID 放在一个字符串中。

    if (message.author.id !== "821682594830614578") {
      return;
    }