async function threadSetup(interaction) {
const thread = await interaction.channel.threads.create({
name: `Welcome, ${interaction.user.username}!`,
autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
type: ChannelType.PrivateThread,
reason: "Welcome to the Server!",
});
await thread.join();
await thread.members.add(interaction.user.id);
await thread.send("Please post your email in this thread.");
interaction.reply("I've created a thread for validation. You can open it from the sidebar!");
const collector = thread.createMessageCollector({ max: 1, time: 3600000 });
collector.on("collect", (m) => {
console.log("For debugging");
const emails = fs.readFileSync(EMAILS_PATH);
if (emails.includes(m.content)) m.reply("Identified");
else m.reply("Not identified");
collector.stop();
});
}
async function threadSetup(interaction) {
const thread = await interaction.channel.threads.create({
name: `Welcome, ${interaction.user.username}!`,
autoArchiveDuration: ThreadAutoArchiveDuration.OneHour,
type: ChannelType.PrivateThread,
reason: "Welcome to the Server!",
});
await thread.join();
await thread.members.add(interaction.user.id);
await thread.send("Please post your email in this thread.");
interaction.reply("I've created a thread for validation. You can open it from the sidebar!");
const collector = thread.createMessageCollector({ max: 1, time: 3600000 });
collector.on("collect", (m) => {
console.log("For debugging");
const emails = fs.readFileSync(EMAILS_PATH);
if (emails.includes(m.content)) m.reply("Identified");
else m.reply("Not identified");
collector.stop();
});
}