From 2353444cc732748428df87d9be833c9f9eeac7f8 Mon Sep 17 00:00:00 2001 From: cAttte <26514199+cAttte@users.noreply.github.com> Date: Thu, 17 Dec 2020 18:55:57 -0300 Subject: [PATCH] feat(commands): create teamOwner command --- src/commands/teamOwner.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/commands/teamOwner.ts diff --git a/src/commands/teamOwner.ts b/src/commands/teamOwner.ts new file mode 100644 index 00000000..8e15da4d --- /dev/null +++ b/src/commands/teamOwner.ts @@ -0,0 +1,28 @@ +import Client from "../struct/Client" +import Message from "../struct/discord/Message" +import Args from "../struct/Args" +import Command from "../struct/Command" +import Roles from "../util/roles" + +export default new Command({ + name: "teamowner", + aliases: ["bto", "to", "promote"], + description: "Make a member Team Owner.", + permission: Roles.REGIONAL_BUILD_TEAM_LEAD, + usage: "", + async run(this: Command, client: Client, message: Message, args: Args) { + const user = await args.consumeUser() + if (!user) + return message.channel.sendError( + user === undefined + ? "You must provide a user to make Team Owner!" + : "Couldn't find that user." + ) + const member = message.guild.member(user) + if (!member) return message.channel.sendError("The user is not in the server!") + + const role = message.guild.roles.cache.find(r => r.name === Roles.TEAM_OWNER) + await member.roles.add(role) + await message.channel.sendSuccess(`Made <@${user.id}> Team Owner!`) + } +})