Julian Patt
Julian Patt

Reputation: 1

javascript discord bot only answers in DMs

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.

Upvotes: 0

Views: 185

Answers (0)

Related Questions