I just started coding my Discord bot and I made a command that replies to every message that isn’t sent by a bot. When I tried it in DMs it works fine, but when I tried it in my server it would mention the user before the command. In the DM it would say just “test”, but in the server it would say something like “@ExampleUser, test”.
Is there a way I can fix this? Here’s my code:
JavaScript
x
8
1
const Discord = require('discord.js');
2
const client = new Discord.Client();
3
4
client.on("message", (message) => {
5
if (message.author.bot) return;
6
return message.reply("test")
7
});
8
Advertisement
Answer
Instead of message.reply('test')
use message.channel.send('test')
that sends a message to the channel the original message was sent to.