While I was coding a command for my bot:
client.on('message', message=> {
if (message.content.valueOf('ip'))
message.channel.send(
"Our Server IP is `blank` For Java. For Bedrock it is `blank` and port `blank`."
)
});
The bot would auto reply to itself. Is there any piece of code I can add to make it not do this?
Fixed: replaced .valueOf to .includes
The code if (message.author.id === client.user.id) return; checks if the message's author is the same as client's user (your bot) and skips the rest of the code.