Bot failing to create thread

My code I can see that every time that bot gets online I get the message Pull-Request#8735 is online but it does not react to test message to create thread
const { Client } = require("discord.js");

const client = new Client({
intents: [395137017856],
});

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

client.on("messageCreate", async (message) => {
console.log(message);
// Check if the message is from a bot or not
if (message.author.bot) return;

// Check if the message content matches your trigger
if (message.content.toLowerCase() === `test`) {
let currentDate = new Date().toJSON().slice(0, 10);
let threadName = `${currentDate} Pull requests!`;
// Create a new thread in the same channel as the message
const thread = await message.channel.threads.create({
name: threadName, // Replace with your desired thread name
type: "GUILD_PUBLIC_THREAD",
reason: "test",
});

// Send a confirmation message
message.reply(`Thread created: ${thread.name}`);
}
});

client.login(
"xxxxxx"
);
const { Client } = require("discord.js");

const client = new Client({
intents: [395137017856],
});

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

client.on("messageCreate", async (message) => {
console.log(message);
// Check if the message is from a bot or not
if (message.author.bot) return;

// Check if the message content matches your trigger
if (message.content.toLowerCase() === `test`) {
let currentDate = new Date().toJSON().slice(0, 10);
let threadName = `${currentDate} Pull requests!`;
// Create a new thread in the same channel as the message
const thread = await message.channel.threads.create({
name: threadName, // Replace with your desired thread name
type: "GUILD_PUBLIC_THREAD",
reason: "test",
});

// Send a confirmation message
message.reply(`Thread created: ${thread.name}`);
}
});

client.login(
"xxxxxx"
);
8 Replies
d.js toolkit
d.js toolkit10mo 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
chewie
chewie10mo ago
the "intents" you provided aren't valid.
MantasSil
MantasSilOP10mo ago
I used integer from here
No description
chewie
chewie10mo ago
thats permissions, not intents
d.js docs
d.js docs10mo ago
:guide: Popular Topics: Gateway Intents read more
MantasSil
MantasSilOP10mo ago
error: new Error("Used disallowed intents") so I need to select intents as well as permissions?
d.js docs
d.js docs10mo ago
- Error [DisallowedIntents]: Privileged intent provided is not enabled or whitelisted. - Error: Used disallowed intents If you are using the GuildMembers, GuildPresences, or MessageContent intents, you need to enable them via Developer Portal > Your app > Bot > Privileged Gateway Intents
MantasSil
MantasSilOP10mo ago
Thank you sir !close
Want results from more Discord servers?
Add your server