Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports.run = async (client, message, args) => {
- let role = args.join(" ").split("<@&").join("").split(">") || args.join(" ").split(">");
- if (!role[0]) return message.channel.send(":x::zap: | Specify a role!");
- //debug
- console.log(role);
- // returns ["name of old role", "new name"]
- console.log(role[0]);
- // returns "name of old role"
- let grole = message.guild.roles.find("id", role[0]) || message.guild.roles.find("name", role[0]);
- //console.log(grole);
- // returns null
- if (!grole) return message.channel.send(":x::zap: | Couldn't find that role..");
- let newName = role[2];
- if (!role[2]) newName = role[1];
- console.log(newName);
- grole.edit({name: newName})
- .then(updated => message.channel.send(`Your selected role now has the name \`${updated.name}\` (${grole})!`));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement