Support, staff, and admin commands, and n?dev fixes. A few other bugfixes

master
Kit Kasune 4 years ago
parent 403c9443d5
commit 7b2be3c710
  1. 26
      commands/admin.js
  2. 7
      commands/developer.js
  3. 36
      commands/staff.js
  4. 36
      commands/support.js
  5. 28
      events/guildCreate.js
  6. 2
      events/ready.js
  7. 2
      handle/event.js

@ -1,12 +1,36 @@
const Discord = require('discord.js'); const Discord = require('discord.js');
const UserData = require('../models/user');
module.exports = { module.exports = {
name: "admin", name: "admin",
help: new Discord.MessageEmbed() help: new Discord.MessageEmbed()
.setTitle("Help -> Admin") .setTitle("Help -> Admin")
.setDescription("Make a user a Natsuki admin") .setDescription("Make a user a Natsuki admin")
.addField("Syntax", "`admin <add|remove|check> <@user|userID>`"), .addField("Syntax", "`admin <add|remove|check> <@user|userID>`")
.addField("Notice", "This command is only available to Natsuki developers."),
async execute(message, msg, args, cmd, prefix, mention, client) { 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}\``);} if (!args.length) {return message.channel.send(`Syntax: \`${prefix}\``);}
let person = mention ? mention : args[1] ? client.users.cache.has(args[1]) ? client.users.cache.get(args[1]) : null : null;
let tu = await UserData.findOne({uid: person ? person.id : message.author.id}) ? await UserData.findOne({uid: person ? person.id : message.author.id}) : new UserData({uid: person ? person.id : message.author.id});
if (['c', 'check'].includes(args[0])) {return message.reply(`${person ? person : message.member.displayName} ${tu.admin ? 'is' : 'is not'} a Natsuki Admin.`);}
if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as an admin.");}
if (!person) {return message.reply("You must mention someone to add as an admin, or use their 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 set admin statuses.');}
if (['a', 'add'].includes(args[0])) {tu.support = true; tu.staff = true; tu.admin = true;}
else {tu.admin = false; tu.developer = false;}
tu.save();
const logemb = (act) => new Discord.MessageEmbed()
.setAuthor(`Admin ${act}`, message.author.avatarURL())
.setDescription("A user's Admin status was updated.")
.setThumbnail(person.avatarURL({size: 1024}))
.addField("Name", person.username, true)
.addField("Developer", message.author.username, true)
.setColor("e8da3a")
.setFooter("Natsuki")
.setTimestamp();
client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915').send(logemb(['a', 'add'].includes(args[0]) ? 'Added' : 'Removed'));
return message.reply(`${message.guild.members.cache.get(person.id).displayName} is now an admin!`);
} }
}; };

@ -20,14 +20,15 @@ module.exports = {
if (!person) {return message.reply("You must mention someone to add as a developer, or use their ID.");} if (!person) {return message.reply("You must mention someone to add as a developer, or use their ID.");}
let atu = await UserData.findOne({uid: message.author.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.');} 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.');}
tu.developer = ['a', 'add'].includes(args[0]); if (['a', 'add'].includes(args[0])) {tu.support = true; tu.staff = true; tu.admin = true; tu.developer = true;}
else {tu.developer = false;}
tu.save(); tu.save();
const logemb = (act) => new Discord.MessageEmbed() const logemb = (act) => new Discord.MessageEmbed()
.setAuthor(`Developer ${act}`, message.author.avatarURL()) .setAuthor(`Developer ${act}`, message.author.avatarURL())
.setDescription("A user's Developer status was updated.") .setDescription("A user's Developer status was updated.")
.setThumbnail(message.guild.iconURL({size: 1024})) .setThumbnail(person.avatarURL({size: 1024}))
.addField("Name", person.username, true) .addField("Name", person.username, true)
.addField("Admin", message.author.username, true) .addField("Developer", message.author.username, true)
.setColor("e8da3a") .setColor("e8da3a")
.setFooter("Natsuki") .setFooter("Natsuki")
.setTimestamp(); .setTimestamp();

@ -0,0 +1,36 @@
const Discord = require('discord.js');
const UserData = require('../models/user');
module.exports = {
name: "admin",
help: new Discord.MessageEmbed()
.setTitle("Help -> Staff")
.setDescription("Make a user a Natsuki staff member")
.addField("Syntax", "`admin <add|remove|check> <@user|userID>`")
.addField("Notice", "This command is only available to Natsuki developers."),
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}\``);}
let person = mention ? mention : args[1] ? client.users.cache.has(args[1]) ? client.users.cache.get(args[1]) : null : null;
let tu = await UserData.findOne({uid: person ? person.id : message.author.id}) ? await UserData.findOne({uid: person ? person.id : message.author.id}) : new UserData({uid: person ? person.id : message.author.id});
if (['c', 'check'].includes(args[0])) {return message.reply(`${person ? person : message.member.displayName} ${tu.admin ? 'is' : 'is not'} a part of Natsuki Staff.`);}
if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as a Staff Member.");}
if (!person) {return message.reply("You must mention someone to add as a staff member, or use their 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 set staff member statuses.');}
if (['a', 'add'].includes(args[0])) {tu.support = true; tu.staff = true;}
else {tu.staff = false; tu.admin = false; tu.developer = false;}
tu.save();
const logemb = (act) => new Discord.MessageEmbed()
.setAuthor(`Staff ${act}`, message.author.avatarURL())
.setDescription("A user's Staff status was updated.")
.setThumbnail(person.avatarURL({size: 1024}))
.addField("Name", person.username, true)
.addField("Developer", message.author.username, true)
.setColor("e8da3a")
.setFooter("Natsuki")
.setTimestamp();
client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915').send(logemb(['a', 'add'].includes(args[0]) ? 'Added' : 'Removed'));
return message.reply(`${message.guild.members.cache.get(person.id).displayName} is now a staff member!`);
}
};

@ -0,0 +1,36 @@
const Discord = require('discord.js');
const UserData = require('../models/user');
module.exports = {
name: "admin",
help: new Discord.MessageEmbed()
.setTitle("Help -> Support")
.setDescription("Make a user a Natsuki Support Team member")
.addField("Syntax", "`admin <add|remove|check> <@user|userID>`")
.addField("Notice", "This command is only available to Natsuki admin."),
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}\``);}
let person = mention ? mention : args[1] ? client.users.cache.has(args[1]) ? client.users.cache.get(args[1]) : null : null;
let tu = await UserData.findOne({uid: person ? person.id : message.author.id}) ? await UserData.findOne({uid: person ? person.id : message.author.id}) : new UserData({uid: person ? person.id : message.author.id});
if (['c', 'check'].includes(args[0])) {return message.reply(`${person ? person : message.member.displayName} ${tu.admin ? 'is' : 'is not'} a part of Natsuki Support.`);}
if (!['a', 'add', 'r', 'remove'].includes(args[0])) {return message.reply("You must specify whether to `add` or `remove` someone as a Support Team Member.");}
if (!person) {return message.reply("You must mention someone to add as a support member, or use their ID.");}
let atu = await UserData.findOne({uid: message.author.id});
if (!atu && !atu.admin) {return message.reply('You must be an admin in order to add set support team member statuses.');}
if (['a', 'add'].includes(args[0])) {tu.support = true;}
else {tu.support = false; tu.staff = false; tu.admin = false; tu.developer = false;}
tu.save();
const logemb = (act) => new Discord.MessageEmbed()
.setAuthor(`Support ${act}`, message.author.avatarURL())
.setDescription("A user's Support status was updated.")
.setThumbnail(person.avatarURL({size: 1024}))
.addField("Name", person.username, true)
.addField("Developer", message.author.username, true)
.setColor("e8da3a")
.setFooter("Natsuki")
.setTimestamp();
client.guilds.cache.get('762707532417335296').channels.cache.get('762732961753595915').send(logemb(['a', 'add'].includes(args[0]) ? 'Added' : 'Removed'));
return message.reply(`${message.guild.members.cache.get(person.id).displayName} is now a Support Team member!`);
}
};

@ -0,0 +1,28 @@
const Discord = require('discord.js');
const BotDataSchema = require('../models/bot');
module.exports = async (client, guild) => {
/*
* Top.gg API
* GBL API never happening
* Other APIs idk
*/
let botData = await BotDataSchema.findOne({finder: 'lel'});
botData.servers = client.guilds.cache.size;
botData.servers_all += 1;
botData.save();
client.guilds.cache.get('762707532417335296').channels.cache.get('766031709866557471').send(new Discord.MessageEmbed()
.setAuthor('New Guild Added', guild.owner.avatarURL())
.setTitle(guild.name)
.setThumbnail(guild.iconURL({size: 2048}))
.addField('Owner', guild.owner.tag, true)
.addField('Members', guild.members.cache.size)
.addField('Position', `Server #${client.guilds.cache.size}`)
.setColor('55ff7f')
.setFooter('Natsuki')
.setTimestamp()
);
};

@ -63,8 +63,6 @@ module.exports = async client => {
lastRestart: new Date(), lastRestart: new Date(),
errors_all: 0, errors_all: 0,
}); });
botData.servers = client.guilds.cache.size;
botData.servers_all = botData.servers_all + 1;
botData.restarts = botData.restarts + 1; botData.restarts = botData.restarts + 1;
botData.lastRestart = new Date(); botData.lastRestart = new Date();

@ -10,6 +10,6 @@ module.exports = client => {
let evtName = file.split('.')[0]; let evtName = file.split('.')[0];
client.on(evtName, evt.bind(null, client)); client.on(evtName, evt.bind(null, client));
console.log(`${chalk.gray('[LOG] ')} >> ${chalk.blueBright('Loaded Event')} ${chalk.white(evtName)}`); console.log(`${chalk.gray('[LOG] ')} >> ${chalk.blueBright('Loaded Event')} ${chalk.white(evtName)}`);
}; }
console.log(`\n${chalk.gray('[BOOT]')} >> ${chalk.blue('Loaded all Events')}`); console.log(`\n${chalk.gray('[BOOT]')} >> ${chalk.blue('Loaded all Events')}`);
}; };
Loading…
Cancel
Save