const botSettings = require("./botsettings.json");
const Discord = require("discord.js");
const bot = new Discord.Client({
disableEveryone: true
});
console.log(botSettings.token);
console.log(botSettings.prefix);
bot.on("ready", () => {
console.log("Rebot is ready!");
bot.generateInvite(["ADMINISTRATOR"]).then(link => {
console.log(link);
}).catch(err => {
console.log(err.stack);
});
});
bot.on('message', async (message) => {
if (message.content.toLowerCase().startsWith("!colorme"))
message.member.roles.array().some(r => {
if (["Red", "RedOrange", "Orange", "OrangeYellow", "Yellow", "YellowGreen", "Green", "GreenBlue", "Blue", "Indigo", "Violet", "RedViolet", "PastelRed", "PastelOrange", "PastelYellow", "PastelGreen", "PastelBlue", "PastelIndigo", "PastelViolet", "DarkRed", "DarkOrange", "DarkYellow", "DarkGreen", "DarkBlue", "DarkIndigo", "DarkViolet"].includes(r.name)) {
message.member.removeRole(r);
}
})
{
var args = message.content.toLowerCase().split(" ");
// console.log(args);
if (args[1] === 'blue') {
var role = message.guild.roles.find(role => role.name === 'Blue')
addUserRole('Blue', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'red') {
addUserRole('Red', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'redorange') {
addUserRole('RedOrange', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'orange') {
addUserRole('Orange', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'orangeyellow') {
addUserRole('OrangeYellow', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'yellow') {
addUserRole('Yellow', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'yellowgreen') {
addUserRole('YellowGreen', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'green') {
addUserRole('Green', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'greenblue') {
addUserRole('GreenBlue', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'indigo') {
addUserRole('Indigo', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'violet') {
addUserRole('Violet', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'redviolet') {
addUserRole('RedViolet', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'pastelred') {
addUserRole('PastelRed', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'pastelorange') {
addUserRole('PastelOrange', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'pastelyellow') {
addUserRole('PastelYellow', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'pastelgreen') {
addUserRole('PastelGreen', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'pastelblue') {
addUserRole('PastelBlue', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'pastelindigo') {
addUserRole('PastelIndigo', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'pastelviolet') {
addUserRole('PastelViolet', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'darkred') {
addUserRole('DarkRed', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'darkorange') {
addUserRole('DarkOrange', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'darkyellow') {
addUserRole('DarkYellow', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'darkgreen') {
addUserRole('DarkGreen', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'darkblue') {
addUserRole('DarkBlue', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'darkindigo') {
addUserRole('DarkIndigo', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
} else if (args[1] === 'darkviolet') {
addUserRole('DarkViolet', message);
message.channel.send('Role successfully added!')
.then(message => {
message.delete(3000)
})
}
};
})
function addUserRole(roleName, message) {
var role = message.guild.roles.find(role => role.name === roleName);
message.member.addRole(role.id)
if (message.content.startsWith("!colorme")) {
message.delete(3000);
return;
}
};
bot.login(botSettings.token);