Updated index.js

Added Auto Join Role
This commit is contained in:
ItzEmerald authored and GitHub committed 2019-06-18 16:13:38 +01:00
1 parent 73ea5708e3
commit 07d45e50de
1 file changed
+4 -1
+4 -1
View File
@@ -72,10 +72,11 @@ if(!cmd) return;
cmd.run(bot, message, args); cmd.run(bot, message, args);
}); });
// [SupportBot] Welcome Message // [SupportBot] Welcome Message && Auto Join Role
bot.on("guildMemberAdd", (member) => { bot.on("guildMemberAdd", (member) => {
let channel = member.guild.channels.find(channel => channel.name === `${bot.settings.Welcome_Channel}`) let channel = member.guild.channels.find(channel => channel.name === `${bot.settings.Welcome_Channel}`)
let autorole = member.guild.roles.find(autorole => autorole.name === `${bot.settings.Auto_Role}`)
const WelcomeMsg= new Discord.RichEmbed() const WelcomeMsg= new Discord.RichEmbed()
.setColor(bot.settings.colour) .setColor(bot.settings.colour)
@@ -83,6 +84,8 @@ bot.on("guildMemberAdd", (member) => {
.setDescription(`:wave: ${member.user.username}\n${bot.settings.Welcome_Message}`) .setDescription(`:wave: ${member.user.username}\n${bot.settings.Welcome_Message}`)
channel.send(WelcomeMsg); channel.send(WelcomeMsg);
member.addRole(role).catch(console.error);
}); });
// [SupportBot] Leave Message // [SupportBot] Leave Message