receiptify
receiptify
DIAdiscord.js - Imagine an app
Created by receiptify on 11/25/2023 in #djs-questions
threads issue
guild.threads.cache.forEach((thread) => { ^ TypeError: Cannot read properties of undefined (reading 'cache') code : client.once('ready', () => { console.log(Logged in as ${client.user.tag}); const guild = client.guilds.cache.get(guildId); if (!guild) { console.error(Guild with ID ${guildId} not found.); return; } console.log(Found guild: ${guild.name} (${guild.id})); guild.threads.cache.forEach((thread) => { console.log(Sending message to thread: ${thread.name} (${thread.id})); thread.send(hardcodedMessage) .then(() => console.log(Sent message to thread: ${thread.name})) .catch((error) => console.error(Error sending message to thread: ${thread.name}, error)); }); });
2 replies