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"
);