** is hidden because of abusive language.
What code should I reply to when I find a sentence with a specific message?
client.on("messageCreate", (msg)=>{
if(message.content.match==="**"){
msg.reply("Don't abuse, slander, etc.");
}
});
I don't know much about node.js (JavaScript) or discord.js myself, so I'm not very confident, but
The code in the question appears to be a mixture of comparison (===
) and pattern match (match
).
If you want to react to a containing the specified keyword, you will see the following:
Create multi-function bot with discord.js - Qiita
client.on('message',message=>{
if(message.content.match(/write this word/)){
message.channel.send('Send a message in here');
}
});
Use ===
to react when the contents of the message match (exactly) with the specified keyword.
client.on('message',message=>{
if(message.content==='Enter this word'){
message.channel.send('React with this word');
}
});
581 PHP ssh2_scp_send fails to send files as intended
610 GDB gets version error when attempting to debug with the Presense SDK (IDE)
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
912 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.