chicken man
chicken man
DIAdiscord.js - Imagine an app
Created by chicken man on 11/17/2024 in #djs-questions
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???
3 replies
DIAdiscord.js - Imagine an app
Created by chicken man on 11/17/2024 in #djs-questions
message event not working
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