From af29f51ad2e46fa013041e8cd680d3c0f067225f Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Sun, 11 Oct 2020 13:53:08 -0600 Subject: [PATCH] Start n?developer --- commands/developer.js | 23 +++++++++++++++++++++++ commands/userinfo.js | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 commands/developer.js diff --git a/commands/developer.js b/commands/developer.js new file mode 100644 index 0000000..17374ad --- /dev/null +++ b/commands/developer.js @@ -0,0 +1,23 @@ +const Discord = require('discord.js'); +const mongoose = require('mongoose'); +const UserData = require('../models/user'); + +module.exports = { + name: "developer", + aliases: ['dev'], + help: new Discord.MessageEmbed() + .setTitle("Help -> Developer") + .setDescription("Add or remove users as Natsuki developers.") + .addField("Syntax", "`developer <@user|userID>`") + .addField("Notice", "You must already be a developer of Natsuki in order to use this command."), + async execute(message, msg, args, cmd, prefix, mention, client) { + if (!message.guild) {return message.reply("This is a guild-only command!");} + if (!args.length) {return message.channel.send(`Syntax: \`${prefix}developer <@user|userID>\``);} + if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as a developer.");} + let person = mention ? mention : args[1] ? client.users.cache.has(args[1]) ? client.users.cache.get(args[1]) : null : null; + if (!person) {return message.reply("You must mention someone to add as a developer, or use their ID.");} + let tu = await UserData.findOne({uid: person.id}) ? await UserData.findOne({uid: person.id}) : new UserData({uid: person.id}); + let atu = await UserData.findOne({uid: message.author.id}); + if (!atu && !atu.developer && !client.developers.includes(message.author.id)) {return message.reply('You must be a developer in order to add or remove someone else as a developer.');} + } +}; \ No newline at end of file diff --git a/commands/userinfo.js b/commands/userinfo.js index 2e8be40..2dcf690 100644 --- a/commands/userinfo.js +++ b/commands/userinfo.js @@ -23,7 +23,7 @@ module.exports = { if (message.guild) { infoembed.addField('In Server Since', moment(person.joinedAt).fromNow(), true) - .addField('Highest Role in Server', person.roles.highest.name, true) + .addField('Highest Role in Server', `<@&${person.roles.highest.id}>`, true) } if (tu) {