From 1c26c9168dc49e03274328cde1a98d8f7235032c Mon Sep 17 00:00:00 2001 From: Chad Doty Date: Tue, 24 Feb 2026 11:21:26 -0500 Subject: [PATCH] Fixed welcome channel id fetch --- index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 5fede51..e44903f 100644 --- a/index.js +++ b/index.js @@ -17,10 +17,12 @@ if (!BOT_TOKEN) { } client.on(Events.Ready, () => { - /* This will log the bot's username and discriminator to the console when it successfully logs in - * For some reason, client.user.tag doesn't work, so we have to concatenate the username and discriminator manually. - */ - console.log(`Online! Logged in as ${client.user.username}#${client.user.discriminator}`); + /* This will log the bot's username and discriminator to the console when it successfully logs in + * For some reason, client.user.tag doesn't work, so we have to concatenate the username and discriminator manually. + */ + console.log( + `Online! Logged in as ${client.user.username}#${client.user.discriminator}`, + ); }); client.on(Events.GuildMemberAdd, async (member) => { @@ -28,8 +30,8 @@ client.on(Events.GuildMemberAdd, async (member) => { await member.roles.add(AUTO_ROLE_ID); console.log(`Assigned role to ${member.user.username}`); - const welcomeChannel = - await member.guild.channels.fetch(WELCOME_CHANNEL_ID); + // Fixed the error here. Needed client not member to fetch the channel. + const welcomeChannel = await client.channels.fetch(WELCOME_CHANNEL_ID); if (welcomeChannel) { // This is my example for my server welcome message, feel free to change it up to fit your server's vibe! await welcomeChannel.send(