const { Client, Intents } = require('discord.js');
const client = new Client({intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_MEMBERS" , "DIRECT_MESSAGES" ,"DIRECT_MESSAGE_TYPING"], }); //
const {
MessageEmbed,
} = require("discord.js");
const ms = require('ms') // npm install ms in your console or terminal
client.on('guildMemberAdd', async (member) => {
const msg = `hello` // here put the message
const time = `5s` // set it as you like ex 10s , 1m
const channel = member.guild.channels.cache.get('45645845656562'); // here put id of channel that will send to it message when someone enter the server
const message = await channel.send({ content : `${member}` , embeds: [new MessageEmbed().setDescription(`${msg}`)] });
setTimeout(() => {
message.delete();
}, ms(`${time}`));
})