I am trying to set my first discord bot. I got the bot running from VSC and online with Heroku which is also auto-updating with my Github.
I need support because it seems my bot is not responding to any of my messages.
Here is my index file code, which I named "bot.js"
require("dotenv").config();
const Discord = require("discord.js");
client = new Discord.Client({ intents: 32767 });
client.on("ready", () => {
console.log("Our bot is ready to go");
});
client.on("message", async (message) => {
if (message.content === "ping") {
message.reply("pong");
}
});
client.login(process.env.BOT_TOKEN);
The bot is online and on the server I want it to, with admin permissions as well. I am sure the intents are right, so there should be no issue.
Thank you!
CodePudding user response:
The error seems to be the way you declare your intents. The intents you put in your code was the way to declare all intents in V13, however in V14 the way to declare all intents is 131071
. However for just sending messages I would recommend you only use the intents required, therefore your code could look something like:
// Alternativly you could do "intents: 131071" for all intents
const client = new Discord.Client({ intents: ["GuildMessages", "MessageContent"] });
client.on("ready", () => {
console.log("Our bot is ready to go");
});