cannot recieve direct messages

i have partials (which apparently has been the solution for literally everyone else on this planet) code:
const client = new Client({
intents: [
"Guilds",
"GuildMembers",
"GuildMessages",
"MessageContent",
"DirectMessages",
],
partials: ["Message", "Channel"],
});

client.on("messageCreate", async (message) => {
if (message.channel.type === 1) {
fs.appendFileSync(
"../pepperbot/src/logs/directmessages.log",
"direct message from: " +
message.author.username +
"(" +
message.author +
") at " +
Date() +
' with: "' +
message.content +
'"\n'
);
};
};
const client = new Client({
intents: [
"Guilds",
"GuildMembers",
"GuildMessages",
"MessageContent",
"DirectMessages",
],
partials: ["Message", "Channel"],
});

client.on("messageCreate", async (message) => {
if (message.channel.type === 1) {
fs.appendFileSync(
"../pepperbot/src/logs/directmessages.log",
"direct message from: " +
message.author.username +
"(" +
message.author +
") at " +
Date() +
' with: "' +
message.content +
'"\n'
);
};
};
nodejs version 19.0.0, discordjs version 14.13.0
8 Replies
d.js toolkit
d.js toolkit16mo 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 OP
ayeuhugyu
ayeuhugyuOP16mo ago
btw changing
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
],
partials: [Partials.Message, Partials.Channel],
});
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
],
partials: [Partials.Message, Partials.Channel],
});
to that doesn't fix anything
kin.ts
kin.ts16mo ago
djs doesn't have export named Partials iirc, it's Partial
ayeuhugyu
ayeuhugyuOP16mo ago
yeah i've done that it doesn't print anything yeah other things i've made work yeah theres other code inbetween, but none of it affects that the other code inbetween is stuff listening for memberjoins and message deletes and bot ready
kin.ts
kin.ts16mo ago
client.login() ?
ayeuhugyu
ayeuhugyuOP16mo ago
yeah thats at the end of the file yeah that works
urretf
urretf16mo ago
try commenting out the entire section in between and see if the issue is still present
ayeuhugyu
ayeuhugyuOP16mo ago
how did that fix it imn gonna uncomment stuff until i find out whats breaking it wh i uncommented everything and it just works now even though its LITERALLY THE EXACT SAME CODE??? ok idk it works so uh thanks i guess?
Want results from more Discord servers?
Add your server