MantasSil
MantasSil
DIAdiscord.js - Imagine an app
Created by MantasSil on 2/29/2024 in #djs-questions
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"
);
10 replies