From 3f6af0e62e5c4f4572aa83a1b839d3b5902c8f74 Mon Sep 17 00:00:00 2001 From: Sepp J Morris Date: Mon, 12 Oct 2020 21:33:14 +0200 Subject: [PATCH] Last commit. Now it's your turn --- zoizbot/commands/moderation/addrole.js | 22 ++++++++++++++++++++++ zoizbot/zoizbot.njsproj | 3 +++ 2 files changed, 25 insertions(+) create mode 100644 zoizbot/commands/moderation/addrole.js diff --git a/zoizbot/commands/moderation/addrole.js b/zoizbot/commands/moderation/addrole.js new file mode 100644 index 0000000..090ee99 --- /dev/null +++ b/zoizbot/commands/moderation/addrole.js @@ -0,0 +1,22 @@ +//simple add role to user command. +// im done. im not going to finish it, Adios see you in another project +exports.run = async (zoizbot, message, args) => { + + if (!message.member.hasPermission("MANAGE_ROLES")) + return message.reply("Sorry, you don't have permissions to use this!") + + let member = message.mentions.members.first(); + let role = message.mentions.roles.first(); + + if (!member) + return message.reply("Please mention a valid member of this server"); + if (!role || role.length < 1) + return message.reply("Please provide the role you want to add."); + + member.roles.add(role).catch(console.error); + + // TODO: catch the errors and reply . cant be bothered at the moment + + //member.roles.remove(role).catch(console.error); //remove + +} \ No newline at end of file diff --git a/zoizbot/zoizbot.njsproj b/zoizbot/zoizbot.njsproj index b6c56e4..4ee5d2d 100644 --- a/zoizbot/zoizbot.njsproj +++ b/zoizbot/zoizbot.njsproj @@ -53,6 +53,9 @@ Code + + Code + Code