Skip to content
This repository has been archived by the owner on Mar 27, 2021. It is now read-only.

Commit

Permalink
updated autorole
Browse files Browse the repository at this point in the history
  • Loading branch information
ゼクロ committed Dec 21, 2017
1 parent 88bda60 commit ab7e022
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const config = JSON.parse(fs.readFileSync('config.json', 'utf8'))
var client = new Discord.Client()


const AUTOROLEID = "289905364055621634"
const AUTOROLEID = "332164463186673666"


client.on('ready', () => {
Expand Down Expand Up @@ -37,7 +37,7 @@ client.on('message', (msg) => {
chan = msg.channel,
guild = msg.guild

if (author.id != client.user.id && cont.startsWith(config.prefix)) {
if (msg.channel.type == "text" && author.id != client.user.id && cont.startsWith(config.prefix)) {

// ::say hello world!
var invoke = cont.split(' ')[0].substr(config.prefix.length),
Expand All @@ -53,13 +53,14 @@ client.on('message', (msg) => {

client.on('guildMemberAdd', (memb) => {
var guild = memb.guild

var role = guild.roles.find(r => r.id == AUTOROLEID)
if (role) {
memb.addRole(role)
memb.send("", Discord.RichEmbed().setDescription(`Hey! YOu got automatically assigned the role <@&${AUTOROLEID}>!`))
memb.sendMessage('', new Discord.RichEmbed()
.setColor(0x29B6F6)
.setDescription(`You got automatically assigned the role <@&${AUTOROLEID}>.`)
)
}

})


Expand Down

0 comments on commit ab7e022

Please sign in to comment.