message event not working

sorry, accidently marked the previous post i made as "resolved"
import express from "express";
import Discord, {
ActionRowBuilder,
ActivityType,
ButtonBuilder,
ButtonStyle,
StringSelectMenuBuilder,
StringSelectMenuOptionBuilder
} from "discord.js";
import fs from "fs";
import "dotenv/config";

const client = new Discord.Client({
intents: [
Discord.GatewayIntentBits.Guilds,
Discord.GatewayIntentBits.GuildMessages,
Discord.GatewayIntentBits.MessageContent
],
presence: {
activities: [{
name: "ballsack",
type: ActivityType.Watching
}],
status: "online"
}
});

client.on("ready", () => console.log(`\n● ${client.user.tag} is online\n`));

client.on("messageCreate", async (message) => {
console.log(`Message received: "${message.content}" from ${message.author.tag}`);
});

client.on("interactionCreate", async i => {
i.reply(i.commandName)
});

client.login(process.env.CLIENT_TOKEN);

const app = express();

app.listen(9999, () => {
console.log("\n:: Web Server Started ::");
});

app.get("/", (req, res) => {
res.send("Bot is running");
});
import express from "express";
import Discord, {
ActionRowBuilder,
ActivityType,
ButtonBuilder,
ButtonStyle,
StringSelectMenuBuilder,
StringSelectMenuOptionBuilder
} from "discord.js";
import fs from "fs";
import "dotenv/config";

const client = new Discord.Client({
intents: [
Discord.GatewayIntentBits.Guilds,
Discord.GatewayIntentBits.GuildMessages,
Discord.GatewayIntentBits.MessageContent
],
presence: {
activities: [{
name: "ballsack",
type: ActivityType.Watching
}],
status: "online"
}
});

client.on("ready", () => console.log(`\n● ${client.user.tag} is online\n`));

client.on("messageCreate", async (message) => {
console.log(`Message received: "${message.content}" from ${message.author.tag}`);
});

client.on("interactionCreate", async i => {
i.reply(i.commandName)
});

client.login(process.env.CLIENT_TOKEN);

const app = express();

app.listen(9999, () => {
console.log("\n:: Web Server Started ::");
});

app.get("/", (req, res) => {
res.send("Bot is running");
});
this code worked a year ago, but now it doesnt after i create an "app", which doesn't even show up on discord as a bot anymore but rather as some sort of integration. my slash commands work fine but the "app" doesn't listen to new messages in the client.on("messageCreate") event. did i miss something or can my app NOT listen to messages anymore in a channel???
2 Replies
d.js toolkit
d.js toolkit14h ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
NyR
NyR14h ago
Make sure you have invited the app with bot scope
Want results from more Discord servers?
Add your server