我最近爲我的不和服務器創建了一個bot。現在我想讓他過濾不好的單詞。由discord bot(JavaScript)過濾字詞
例如:
用戶(不含BOT):你是個混蛋
用戶(含BOT):你是[我很愚蠢,因爲我發誓]
這甚至可能在Discord?我給了我的機器人所有權限! (包括刪除消息,它不能用程序自我編輯消息)
如果這是不可能的^我們可以做以下事情嗎?
直接刪除該消息並編寫以下的能力:
BOT:@username不要發誓!
現在我有以下代碼(我不知道是否有用):
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready',() => {
console.log('Hello, the bot is online!')
});
client.on('message', message => {
if(message.content === '--Trump'){
message.reply('He is the president of the United States of
America!');
}
if(message.content === '--Putin'){
message.reply('He is the president of Russia!');
}
});
client.login('MzAwMzM5NzAyMD*1NDUxNzc4.C8rH5w.M44LW*nrfbCR_zHzd**vtMqkr6nI');
你有沒有打擾過[檢查文檔](https://discord.js.org/#/docs/main/stable/class/Message?scrollTo=edit)? –
@AndréDion不,謝謝你的鏈接!我相當新的JavaScript。我如何使用該代碼? –
請隱藏您的client.login()行。我敢肯定你不希望人們隨機訪問你的機器人,如果我是正確的... – Arctiic