I'm creating a discord bot in NodeJS using discord.js module and I want to send a predefined message in the same channel where a user sends a particular text command. eg.
const token = 'xyz';
const client = new Discord.Client();
client.on('message', (message) => {
if (message.content === '!hi') {
message.channel.send('Hello ${message.author}!');
};
});
client.on('ready', () => {
console.log('Bot is now connected');
// client.channels.find(x => x.name === 'test').send('Hello I\'m now connected.');
});
client.login(token);```
client.on('message', (message) => {
if (message.content === '!hi') {
message.channel.send('Hello ${message.author}!'); }});
I expect the output to be Hello @discordusername!
but instead, I'm getting Hello ${message.author}!