本文介紹了Discord.js 刪除單個(gè)消息的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!
問(wèn)題描述
我目前正在使用 Discord.js 創(chuàng)建一個(gè) Discord 機(jī)器人,我想要一個(gè)命令你可以告訴它 ||say Hello
什么的,它會(huì)刪除你的評(píng)論,然后說(shuō)出你告訴它的內(nèi)容.
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.
我當(dāng)前的代碼是
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));
}
});
但這不起作用.
推薦答案
原來(lái)我的代碼是正確的,但我的機(jī)器人必須有版主權(quán)限.
It turns out that I had the correct code, but my bot had to have moderator permissions.
這篇關(guān)于Discord.js 刪除單個(gè)消息的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!