channel is defnied but its says

const db = require('../../db/manager'); const { EmbedBuilder } = require('discord.js'); module.exports = async (client, member) => { const serverId = member.guild.id; const welcomeChannel = await db.getWelcomeChannel(serverId); const welcomeMessage = await db.getWelcomeMessage(serverId); const welcomeImage = await db.getWelcomeImage(serverId); console.log('Welcome Channel from DB:', welcomeChannel); const embedd = new EmbedBuilder() .setAuthor({ name: "Moxx", iconURL: welcomeImage }) .setTitle('Information') .setColor('#2F3136') .setTimestamp() .setDescription(welcomeMessage) .setFooter({ text: ${client.user.tag}, iconURL: welcomeImage }); if (!welcomeChannel) { return; } const channel = member.guild.channels.cache.get(welcomeChannel); if (!channel) { return; } channel.send({ embeds: [embedd] }); }; node:events:495 throw er; // Unhandled 'error' event ^ TypeError: channel.send is not a function at module.exports (C:\Users\mariu\Desktop\moxx handler\events\discord\guildMemberAdd.js:49:13) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) Emitted 'error' event on Client instance at: at emitUnhandledRejectionOrErr (node:events:398:10) at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
5 Replies
d.js toolkit
d.js toolkit11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by staff
noritem
noritem11mo ago
discord-dashboard@2.1.0 C:\Users\mariu\Desktop\moxx handler +-- discord-handlers@0.0.1 | -- discord.js@14.13.0 deduped -- discord.js@14.13.0 node v18.18.1
tomW
tomW11mo ago
that menas means welcomeChannel, has no value ( null )
table
table11mo ago
wrong channel id probs
treble/luna
treble/luna11mo ago
you're calling .send on a CategoryChannel, which indeed is not a function
Want results from more Discord servers?
Add your server