本文介紹了Discord.js 刪除單個消息的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我目前正在使用 Discord.js 創建一個 Discord 機器人,我想要一個命令你可以告訴它 ||say Hello
什么的,它會刪除你的評論,然后說出你告訴它的內容.
I am currently working on creating a Discord bot using Discord.js, and I want to have a command that you can tell it ||say Hello
or something and it will delete your comment, then say what you told it to.
我當前的代碼是
client.on('message', message => {
if (message.content.startsWith("||say ")) {
message.delete(1000); //Supposed to delete message
message.channel.send(message.content.slice(5, message.content.length));
}
});
但這不起作用.
推薦答案
原來我的代碼是正確的,但我的機器人必須有版主權限.
It turns out that I had the correct code, but my bot had to have moderator permissions.
這篇關于Discord.js 刪除單個消息的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!