#channelID code
16 messages · Page 1 of 1 (latest)
// Set a timeout to end the conversation after 30 seconds of inactivity
const options = { time: 30000 };
// Wait for the user's response
channel.awaitMessages(filter, options)
.then((collected) => {
// Get the first message that was collected
const response = collected.first();
// Extract the channel ID from the response
const channelID = response.content.match(/\d+/)[0];
// Export the channel ID for further usage in other modules
module.exports.channelID = channelID;
// Send a confirmation message
channel.send(`I'll be texting in <#${channelID}> from now on.`);
})
.catch(() => {
channel.send("I didn't get a response. I'll use the default channel for this guild.");
});
})
.catch((error) => {
console.error(`Failed to ask for channel in guild ${guild.name} (${guild.id}): ${error}`);
});
});
},
};
``` channelID code I wrote but the problem is i get the error of Failed to find a text channel in guild Berra Patur (590681191682670593)
even there are 2 or 3 text channels it cant detect them
channel.type needs to be compared with ChannelType.GuildText in v14, what you have there is v12 code
Also the filter for collectors goes into the options now
oh ok i will try that
thanks
@raven dagger hi again const { Events, ChannelType } = require("discord.js"); const channel = guild.channels.cache.find((channel) => channel.type === ChannelType.GUILD_TEXT);
// Set a timeout to end the conversation after 30 seconds of inactivity
const options = {
filter: filter,
time: 30000
};
i made these changes
still no difference 😦
output is still Failed to find a text channel in guild Berra Patur (590681191682670593)
Failed to find a text channel in guild Chibureshka kullanıcısının sunucusu (1082244858196009001)
despite there are text channels
Read again
well i read it again and tried some things but couldnt figure out 😭
can you explain it a bit please
GuildText !== GUILD_TEXT