Fixed welcome channel id fetch
This commit is contained in:
8
index.js
8
index.js
@@ -20,7 +20,9 @@ client.on(Events.Ready, () => {
|
|||||||
/* This will log the bot's username and discriminator to the console when it successfully logs in
|
/* 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.
|
* 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}`);
|
console.log(
|
||||||
|
`Online! Logged in as ${client.user.username}#${client.user.discriminator}`,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on(Events.GuildMemberAdd, async (member) => {
|
client.on(Events.GuildMemberAdd, async (member) => {
|
||||||
@@ -28,8 +30,8 @@ client.on(Events.GuildMemberAdd, async (member) => {
|
|||||||
await member.roles.add(AUTO_ROLE_ID);
|
await member.roles.add(AUTO_ROLE_ID);
|
||||||
console.log(`Assigned role to ${member.user.username}`);
|
console.log(`Assigned role to ${member.user.username}`);
|
||||||
|
|
||||||
const welcomeChannel =
|
// Fixed the error here. Needed client not member to fetch the channel.
|
||||||
await member.guild.channels.fetch(WELCOME_CHANNEL_ID);
|
const welcomeChannel = await client.channels.fetch(WELCOME_CHANNEL_ID);
|
||||||
if (welcomeChannel) {
|
if (welcomeChannel) {
|
||||||
// This is my example for my server welcome message, feel free to change it up to fit your server's vibe!
|
// This is my example for my server welcome message, feel free to change it up to fit your server's vibe!
|
||||||
await welcomeChannel.send(
|
await welcomeChannel.send(
|
||||||
|
|||||||
Reference in New Issue
Block a user