diff options
Diffstat (limited to 'src/commands/moderation/addrole.ts')
| -rw-r--r-- | src/commands/moderation/addrole.ts | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/commands/moderation/addrole.ts b/src/commands/moderation/addrole.ts new file mode 100644 index 0000000..ac0dbb6 --- /dev/null +++ b/src/commands/moderation/addrole.ts @@ -0,0 +1,55 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; + +module.exports = class AddRoleModeration extends Command { + constructor(client) { + super(client, { + name: 'addrole', + aliases: ['roleadd'], + group: 'moderation', + memberName: 'addrole', + description: 'Adds a role to a specific user.', + args: [ + { + key: 'userID', + prompt: 'Who would you like to add the role to? (@someone or myself)', + type: 'string', + default: '' + }, + { + key: 'roleID', + prompt: 'What role would you like to add?', + type: 'string' + } + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'], + examples: [ + 'uwu!addrole @CoolRole', + 'uwu!addrole @sin#1337 @CoolRole', + 'uwu!roleadd @sin#1337', + 'uwu!roleadd @sin#1337 @CoolerRole' + ] + }); + } + run(msg: CommandoMessage, { userID, roleID }) { + let role = msg.guild.roles.cache.find(role => role === roleID); + let member = msg.mentions.members?.first(); + if (!userID) { + if (role) { + console.log(role) + member?.roles.add(role) + msg.reply(`The role **${role}** has been added to **${member}**.`) + } else { + msg.reply('Role is either non-existant or you might\'ve mispelled it.') + } + } else if (userID) { + if (role) { + console.log(role) + member?.roles.add(role) + } else { + console.log(role) + msg.reply('Role is either non-existant or you might\'ve mispelled it.') + } + } + } +};
\ No newline at end of file |