message not being read

The bot is not reading the message and replying
63 Replies
d.js toolkit
d.js toolkit•13mo 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!
Elvin
ElvinOP•13mo ago
"discord.js": "^14.13.0"
treble/luna
treble/luna•13mo ago
you do not have the GuildMessages and/or MessageContent intent
Elvin
ElvinOP•13mo ago
when I put GuildMessages or MessageContent it shows error on my terminal
treble/luna
treble/luna•13mo ago
then you have to enable the intent in the developer portal
Elvin
ElvinOP•13mo ago
do you mean this one
No description
treble/luna
treble/luna•13mo ago
the message content one yes
Elvin
ElvinOP•13mo ago
still doesnt work restarted the bot and turned the message content to on
treble/luna
treble/luna•13mo ago
define does not work did you add the intents to your client constructor
Elvin
ElvinOP•13mo ago
okay now it works
import { Client, GatewayIntentBits, IntentsBitField } from "discord.js";
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});
import { Client, GatewayIntentBits, IntentsBitField } from "discord.js";
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});
treble/luna
treble/luna•13mo ago
and how are you listening for messages
Elvin
ElvinOP•13mo ago
when I use the IntentsBitField.GuildMessages it throws error throw new DiscordjsRangeError(ErrorCodes.BitFieldInvalid, bit); ^ RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined.
treble/luna
treble/luna•13mo ago
npm ls discord.js
Elvin
ElvinOP•13mo ago
Didnt send that code jajajaaja already installed?
treble/luna
treble/luna•13mo ago
thats not what i'm asking just run the command
Elvin
ElvinOP•13mo ago
what does it do
treble/luna
treble/luna•13mo ago
it lists the version of djs you are using
Elvin
ElvinOP•13mo ago
treble/luna
treble/luna•13mo ago
did you save your code
Elvin
ElvinOP•13mo ago
yes mam
treble/luna
treble/luna•13mo ago
can you show the full error stack also wait why are you using GatewayIntentBits but telling me you use IntentsBitField
Elvin
ElvinOP•13mo ago
No description
treble/luna
treble/luna•13mo ago
well yeah, IntentsBitField.GuildMessages is indeed undefined
Elvin
ElvinOP•13mo ago
when I used IntentsBitField it gave the above eror
treble/luna
treble/luna•13mo ago
i dont see why you are using both GatewayIntentBits and IntentBitsField
Elvin
ElvinOP•13mo ago
are both the same
treble/luna
treble/luna•13mo ago
if you use it correclty, yes either use GatewayIntentBits.GuildMessages, like you did before
Elvin
ElvinOP•13mo ago
okay
treble/luna
treble/luna•13mo ago
or intentsbitfields but you have to put Flags first which then returns GatewayIntentBits regardless
Elvin
ElvinOP•13mo ago
Idk whats a Flag is it a boolean
treble/luna
treble/luna•13mo ago
its a property just use GatewayIntentBits
Elvin
ElvinOP•13mo ago
okay thanks one more error cannot use import out a module
treble/luna
treble/luna•13mo ago
thats not really djs realted, either change to require()
Elvin
ElvinOP•13mo ago
I have "type":"module" in my package.json
treble/luna
treble/luna•13mo ago
yeah not djs related anymore at this point
Elvin
ElvinOP•13mo ago
client is the bot and guild is the server right
treble/luna
treble/luna•13mo ago
yes
Elvin
ElvinOP•13mo ago
Im trying to run the commands file do i run it npm run start commands.js
treble/luna
treble/luna•13mo ago
those are 3 scripts either run node <yourfile> or create a script and run that script
Elvin
ElvinOP•13mo ago
how do I do that I did this
treble/luna
treble/luna•13mo ago
and what did it output you also ran it before so just run the same command you ran before
Elvin
ElvinOP•13mo ago
node commands.js Started refreshing application (/) commands. Successfully reloaded application (/) commands.
treble/luna
treble/luna•13mo ago
thats to deploy your commands
Elvin
ElvinOP•13mo ago
im confused now I have 2 files index.js and commands.js
treble/luna
treble/luna•13mo ago
that is indeed correct your command.js file is just to deploy your commands your index is your main file
Elvin
ElvinOP•13mo ago
yes
Elvin
ElvinOP•13mo ago
No description
treble/luna
treble/luna•13mo ago
do you have an event handler
Elvin
ElvinOP•13mo ago
nope gotta make one
treble/luna
treble/luna•13mo ago
also why does your account reply with the interaction failed message lol
Elvin
ElvinOP•13mo ago
you shld say Idk lol im getting again module error @wolvinny 🌈
treble/luna
treble/luna•13mo ago
and it again is not djs related
Elvin
ElvinOP•13mo ago
again now its not working
treble/luna
treble/luna•13mo ago
define not working
Elvin
ElvinOP•13mo ago
this is my code its not reading inpt
import { Client, GatewayIntentBits } from "discord.js";
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessageReactions,
],
});

client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`);
});

client.on("interactionCreate", (interaction) => {
if (!interaction.isChatInputCommand()) return;

console.log(interaction.commandName);
});

client.login(
TOKEN
);
import { Client, GatewayIntentBits } from "discord.js";
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessageReactions,
],
});

client.on("ready", () => {
console.log(`Logged in as ${client.user.tag}!`);
});

client.on("interactionCreate", (interaction) => {
if (!interaction.isChatInputCommand()) return;

console.log(interaction.commandName);
});

client.login(
TOKEN
);
Elvin
ElvinOP•13mo ago
have this turned on too
No description
treble/luna
treble/luna•13mo ago
and has your bot logged in
Elvin
ElvinOP•13mo ago
yes its online
treble/luna
treble/luna•13mo ago
intents dont matter here do you run a slash command
Elvin
ElvinOP•13mo ago
yes okay wait how can I make the bot respond to a chat when someone send helo
treble/luna
treble/luna•13mo ago
<Interaction>.reply()
Elvin
ElvinOP•13mo ago
I added a new command and it was succesfully uploaded but its not showing
treble/luna
treble/luna•13mo ago
refresh your discord
Want results from more Discord servers?
Add your server