Skip to content

Commit

Permalink
feat(commands): create teamOwner command
Browse files Browse the repository at this point in the history
  • Loading branch information
cAttte committed Dec 17, 2020
1 parent ffbbaa6 commit 2353444
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/commands/teamOwner.ts
Original file line number Diff line number Diff line change
@@ -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: "<member>",
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!`)
}
})

0 comments on commit 2353444

Please sign in to comment.