discord bot not responding to messages

Viewed 25

so I started making a discord bot recently. I haven't used javascript in a while, so maybe I'm just missing something here, but I can't find any problems with my very basic code for my bot, yet it still doesn't respond to messages.

Unlike other people I have seen ask this question, my bot has been given intents, does not get any error messages in vs code, and comes online perfectly fine. I have given it all the necessary permissions as well on the developer site, so I really can't figure out where I'm going wrong.

Any help is appreciated.

Here's my code:

const Discord = require("discord.js");

const client = new Discord.Client({ intents: ["Guilds", "GuildMessages", "DirectMessages", "GuildMessageReactions", "DirectMessageReactions"]});

client.once("ready", () => {
    console.log('Bot is online!')
});

client.on("message", msg => {
    if (msg.author.bot) return
    
    if (msg.content === 'ping') {
        msg.reply('pong')
    }
});

client.login('my token is here');
0 Answers
Related