Discord.js 删除触发消息

2022-01-10 00:00:00 javascript discord.js

我是 Discord.js 的新手,我希望在机器人响应后删除触发消息,即:

I am new to Discord.js, and I'm looking to delete the trigger message after the bot responds to it, i.e:

!示例

示例机器人响应

Bot 删除了!示例";留言

推荐答案

你可以简单地使用 message.delete().

You can simply use message.delete().

例子:

client.on('message', (msg) => {

// your code

msg.delete()
   .then(() => console.log('Deleted message'))
   .catch(err => console.log(err))

});

相关文章