简体   繁体   English

怎么删除别人的留言? 不和谐JS

[英]How do I delete somebody elses message? Discord.JS

I am working on a say command where the bot deletes the message above it instantly?我正在处理一个say命令,机器人会立即删除它上面的消息吗? How would I find and delete the message above it.我如何找到并删除它上面的消息。 Here is my current code.这是我当前的代码。

if (message.content.includes(prefix + 'say')){
   if (!args[1]){
     return message.channel.send('What should I say?')
   }
   message.channel.send(args.slice(1).join(" "))
 }

All I need is to find and delete the message above it instantly.我所需要的只是立即找到并删除它上面的消息。

You would find and delete the message with the message.delete .您可以使用message.delete查找并删除该消息。 You should put message.delete after message.channel.send(args.slice(1).join(" ")) .您应该将message.delete放在message.delete message.channel.send(args.slice(1).join(" "))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM