My bot wont respond to my commands
Heres my code:
const express = require("express");
const app = express();
app.listen(3000,() => {
console.log("Project is running");
})
app.get("/",(req,res) => {
res.send("Hello world!");
})
const Discord = require("discord.js");
const client = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES"]});
client.login(process.env.token);
client.on("ready", () => {
// Perform any necessary setup tasks here
});
client.on("messageCreate", message => {
if(message.content === "ping") {
message.channel.send("pong!");
} else if (message.content === "!hello") {
message.channel.send("Hello!");
}
});
6 Replies
Have you tried to debug at all?
does your bot have the message content intent?
project shows us as running and bot comes up as online
I made it so it says hello when i run the code and it sends it properly
I’m a pure beginner idk what that is
if you are a beginner discord api isn't the best place to start
start with easier stuff
like what
Learning foundational programming basics, writing basic HTTP servers, understanding NPM ecosystem, incorperating multiple database paradigms, and more advanced HTTP concepts like authorisation, rate limiting, CRUD, ETC.
A discord bot is all of that, plus some and minus others.
You should also be familiar with documentation, and reading how the docs guide you through different concepts of an API or library.