Corrected alreadyJoined to point to the role ID, corrected if statement to account for a boolean. Using sendMessage instead of reply.

This commit is contained in:
chris062689 2017-08-10 20:14:51 -04:00
parent a13f00e18c
commit b7693b2916
1 changed files with 4 additions and 4 deletions

View File

@ -6,14 +6,14 @@ exports.command = function(message) {
var role = '345247291843805185';
message.mentions.users.map((user) => {
let member = message.guild.member(user);
let alreadyJoined = member.roles.has(role.id);
let alreadyJoined = member.roles.has(role);
if (alreadyJoined != null) {
if (alreadyJoined) {
member.removeRole(role);
message.reply(`${user}'s speech has been revoked in the #development channel.`);
message.channel.sendMessage(`${user}'s speech has been revoked in the #development channel.`);
} else {
member.addRole(role);
message.reply(`${user} has been granted speech in the #development channel.`);
message.channel.sendMessage(`${user} has been granted speech in the #development channel.`);
}
});
}