Welcome message not sending

HELP SIR
16 Replies
d.js toolkit
d.js toolkit7mo 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 OP
Mussaplays
MussaplaysOP7mo ago
module.exports = {
name: 'GuildMemberAdd',
async execute(member) {
console.log(`New member joined: ${member.user.tag}`);

const welcomeChannelId = '1238747448046780496';
const welcomeChannel = member.guild.channels.cache.get(welcomeChannelId);

try {
await welcomeChannel.send(`Welcome to the server, ${member.user}!`);
console.log(`Welcome message sent to ${member.user.tag}`);
} catch (error) {
console.error(`${error}`);
}
}
}
module.exports = {
name: 'GuildMemberAdd',
async execute(member) {
console.log(`New member joined: ${member.user.tag}`);

const welcomeChannelId = '1238747448046780496';
const welcomeChannel = member.guild.channels.cache.get(welcomeChannelId);

try {
await welcomeChannel.send(`Welcome to the server, ${member.user}!`);
console.log(`Welcome message sent to ${member.user.tag}`);
} catch (error) {
console.error(`${error}`);
}
}
}
My welcome code
const { Client, GatewayIntentBits, EmbedBuilder, PermissionsBitField, Permissions, MessageManager, Embed, Collection } = require(`discord.js`);
const fs = require('fs');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });

client.commands = new Collection();
require('dotenv').config();


const functions = fs.readdirSync("./src/functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./src/events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./src/commands");

(async () => {
for (file of functions) {
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./src/events");
client.handleCommands(commandFolders, "./src/commands");
client.login(process.env.token)
})();





const { Client, GatewayIntentBits, EmbedBuilder, PermissionsBitField, Permissions, MessageManager, Embed, Collection } = require(`discord.js`);
const fs = require('fs');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] });

client.commands = new Collection();
require('dotenv').config();


const functions = fs.readdirSync("./src/functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./src/events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./src/commands");

(async () => {
for (file of functions) {
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./src/events");
client.handleCommands(commandFolders, "./src/commands");
client.login(process.env.token)
})();





my index.js
Mussaplays
MussaplaysOP7mo ago
This is where i add file
No description
TÆMBØ
TÆMBØ7mo ago
1: You're missing the GatewayIntentBits.GuildMembers intent 2: The event name is guildMemberAdd - lowercase G
Mussaplays
MussaplaysOP7mo ago
it still did not work after i did everthing you tell
TÆMBØ
TÆMBØ7mo ago
Can you share your updated code?
Mussaplays
MussaplaysOP7mo ago
const { Client, GatewayIntentBits, EmbedBuilder, PermissionsBitField, Permissions, MessageManager, Embed, Collection } = require(`discord.js`);
const fs = require('fs');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMembers ] });

client.commands = new Collection();
require('dotenv').config();


const functions = fs.readdirSync("./src/functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./src/events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./src/commands");

(async () => {
for (file of functions) {
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./src/events");
client.handleCommands(commandFolders, "./src/commands");
client.login(process.env.token)
})();





const { Client, GatewayIntentBits, EmbedBuilder, PermissionsBitField, Permissions, MessageManager, Embed, Collection } = require(`discord.js`);
const fs = require('fs');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMembers ] });

client.commands = new Collection();
require('dotenv').config();


const functions = fs.readdirSync("./src/functions").filter(file => file.endsWith(".js"));
const eventFiles = fs.readdirSync("./src/events").filter(file => file.endsWith(".js"));
const commandFolders = fs.readdirSync("./src/commands");

(async () => {
for (file of functions) {
require(`./functions/${file}`)(client);
}
client.handleEvents(eventFiles, "./src/events");
client.handleCommands(commandFolders, "./src/commands");
client.login(process.env.token)
})();





index
module.exports = {
name: 'GuildMemberAdd',
async execute(member) {
console.log(`New member joined: ${member.user.tag}`);

const welcomeChannelId = '1246277461608763392';
const welcomeChannel = member.guild.channels.cache.get(welcomeChannelId);

try {
await welcomeChannel.send(`Welcome to the server, ${member.user}!`);
console.log(`Welcome message sent to ${member.user.tag}`);
} catch (error) {
console.error(`${error}`);
}
}
}
module.exports = {
name: 'GuildMemberAdd',
async execute(member) {
console.log(`New member joined: ${member.user.tag}`);

const welcomeChannelId = '1246277461608763392';
const welcomeChannel = member.guild.channels.cache.get(welcomeChannelId);

try {
await welcomeChannel.send(`Welcome to the server, ${member.user}!`);
console.log(`Welcome message sent to ${member.user.tag}`);
} catch (error) {
console.error(`${error}`);
}
}
}
welcome
Squid
Squid7mo ago
The event's name must be 'guildMemberAdd' with a lowercase "g". Events.GuildMemberAdd returns this same string, but the casing is important
Mussaplays
MussaplaysOP7mo ago
guildMemberAdd
Squid
Squid7mo ago
That's right
Mussaplays
MussaplaysOP7mo ago
No description
Squid
Squid7mo ago
No description
Mussaplays
MussaplaysOP7mo ago
right?
Mussaplays
MussaplaysOP7mo ago
No description
Squid
Squid7mo ago
yes
Mussaplays
MussaplaysOP7mo ago
lets try Thx tysm
Want results from more Discord servers?
Add your server