0

I develop a discord bot in javascript and added the bot to a server. The bot has the permissions to view the channel, view message history and send messages. Sadly, it only replys in DMs.

require("dotenv").config(); //to start process from .env file
const {Client, Intents}=require("discord.js");
const client=new Client({
    Intents:[
        Intents.FLAGS.GUILDS,//adds server functionality
    ]
});
client.once("ready", () =>{
    console.log(` READY - Logged in as ${client.user.tag}!`); //message when bot is online
})


 // messages
 client.on('message', msg => {
    if (msg.content.toLocaleLowerCase()==='hello') {
        msg.reply('hello there!')
    }
})


 

client.login(process.env.TOKEN);

I tried to play around with the permissions on the discord website and to change msg.reply to msg.send and many others. I've gone thru a minimum of 10 tutorials and docs but it still only replies to DMs.

I expected that I get some error codes and informations about why it doesn't respond but nothing happend. Thank you for your help.

  • Does this answer your question? https://stackoverflow.com/questions/69539318/discord-js-bot-not-firing-events-when-a-message-is-sent-after-update – kahveciderin Feb 03 '23 at 20:47
  • 1
    Does this answer your question? [Discord.js bot not firing events when a message is sent after update](https://stackoverflow.com/questions/69539318/discord-js-bot-not-firing-events-when-a-message-is-sent-after-update) – cgp Feb 27 '23 at 03:28

0 Answers0