mirror of
https://github.com/yuzu-emu/Command-fix.git
synced 2024-11-26 00:55:40 +01:00
Using the member object instead of the direct user.
This commit is contained in:
parent
84ed2dd105
commit
16e180ea03
@ -5,13 +5,14 @@ exports.roles = ['Admins', 'Moderators', 'CitraBot'];
|
|||||||
exports.command = function(message) {
|
exports.command = function(message) {
|
||||||
var role = '345247291843805185';
|
var role = '345247291843805185';
|
||||||
message.mentions.users.map((user) => {
|
message.mentions.users.map((user) => {
|
||||||
var alreadyJoined = app.guild.roles.get(role).members.find(member => member.id == user.id);
|
let member = message.guild.member(user);
|
||||||
|
let alreadyJoined = member.roles.has(role.id);
|
||||||
|
|
||||||
if (alreadyJoined != null) {
|
if (alreadyJoined != null) {
|
||||||
user.removeRole(role);
|
member.removeRole(role);
|
||||||
message.reply(`${user}'s speech has been revoked in the #development channel.`);
|
message.reply(`${user}'s speech has been revoked in the #development channel.`);
|
||||||
} else {
|
} else {
|
||||||
user.addRole(role);
|
member.addRole(role);
|
||||||
message.reply(`${user} has been granted speech in the #development channel.`);
|
message.reply(`${user} has been granted speech in the #development channel.`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user