-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
25 lines (20 loc) · 945 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const Discord = require("discord.js"); //Library
const client = new Discord.Client(); //Client creation
const config = require("./config.json"); //Config loading
//===========================================================
client.on('ready', () => { //Bot launched
console.log(`✅ Launched as a bot: ${client.user.tag}!`)
});
//===========================================================
client.on('guildMemberAdd', function(member) {
if(member.user.bot) return; //Ignore if the bot
//Create an Embed message to welcome a new member
const Embed = new Discord.MessageEmbed()
.setColor('#e28a0f')
.setTitle('🎊**[Welcome to the server]**🎊')
.setDescription('<@!' + member + '>');
//Sending what we just created
return client.channels.cache.get(config.WELCOME_CHANNEL).send(Embed);
});
//===========================================================
client.login(config.BOT_TOKEN); //Connect to the bot