fix command

This commit is contained in:
loicbersier 2020-03-18 13:12:14 +01:00
parent e6bbafb7c2
commit 9b49fb70c5

View file

@ -57,7 +57,7 @@ class colorCommand extends Command {
]; ];
if (args.color.match(/^#[0-9A-F]{6}$/i) || ColorResolvable.includes(args.color.toLowerCase()) || colors.includes(args.color.toLowerCase())) { if (args.color.match(/^#[0-9A-F]{6}$/i) || ColorResolvable.includes(args.color.toLowerCase()) || colors.includes(args.color.toLowerCase())) {
let role = message.guild.roles.find(role => role.name === args.color); let role = message.guild.roles.cache.find(role => role.name === args.color);
if (!role) { if (!role) {
message.guild.roles.create({ message.guild.roles.create({
data: { data: {
@ -68,7 +68,7 @@ class colorCommand extends Command {
reason: 'Color command' reason: 'Color command'
}); });
return message.channel.send('Role created! try again to apply it to yourself!'); return message.channel.send('Role created! try again to apply it to yourself!');
} else if (message.guild.member(message.author).roles.has(role.id)) { } else if (message.guild.member(message.author).roles.cache.has(role.id)) {
message.guild.member(message.author).roles.remove(role); message.guild.member(message.author).roles.remove(role);
return message.channel.send('Role removed!'); return message.channel.send('Role removed!');
} }