删除命令或“触发词”消息

时间:2019-03-16 17:44:51

标签: discord discord.js

我有一条消息希望机器人发送,但是为了保持聊天状态整洁,我想删除调用该命令的消息:我该怎么做?
这是消息的当前代码:

if (message.content.toLowerCase().includes("<@botsnumberidhere> what are the numbers")) {
  message.channel.send("This is good, real good.", {
    file: "https://domainforimage.com/image0.jpg" // Or replace with FileOptions object
  });
}

1 个答案:

答案 0 :(得分:0)

您可以使用Message.delete()删除邮件。请注意,这将告诉Discord您要删除该消息,但是您仍然可以访问以前存储的message变量的属性。

if (message.content.toLowerCase().includes("<@botsnumberidhere> what are the numbers")) {
  message.delete(); // You can put it here.
  message.channel.send("This is good, real good.", {
    file: "https://domainforimage.com/image0.jpg"
  });
}