merge conflicts yay

master
Kit Kasune 4 years ago
parent 043123c04a
commit 904c83b20c
  1. 26
      commands/prefix.js
  2. 12
      commands/staffrole.js

@ -0,0 +1,26 @@
const Discord = require('discord.js');
const GuildSettings = require('../util/guild');
module.exports = {
name: "prefix",
help: new Discord.MessageEmbed()
.setTitle("Help -> Prefix")
.setDescription("Changes your server's prefix.")
.addField("Syntax", "`prefix <newPrefix|clear>`")
.addField("Staff Command", "This command requires you to either be admin, or to have the designated staff role.")
.addField("Noticed", "Prefixes are cached, and may take up to a minute to update."),
async execute(message, msg, args, cmd, prefix, mention, client) {
if (!message.guild) {return message.reply("This is a guild-only command!");}
let tguild = await GuildSettings.findOne({gid: message.guild.id})
? await GuildSettings.findOne({gid: message.guild.id})
: new GuildSettings({gid: message.guild.id});
if (!message.member.permissions.has("ADMINISTRATOR") && (!tguild.staffrole.length || !message.guild.roles.cache.has(tguild.staffrole) || !message.member.roles.cache.has(tguild.staffrole))) {return message.reply("You don't have the permissions to use this command here.");}
if (!args.length) {return message.channel.send(`Syntax: \`${prefix} <newPrefix|clear>\`. My current prefix in this server is \`${tguild.prefix.length ? tguild.prefix : 'n?'}\``);}
let np = args[0];
if (np.length > 7) {return message.reply("Hmmm, that prefix is a bit long. Try making something smaller!");}
if (!np.match(/^[a-zA-Z0-9,.!?<>\-_+=/;$#%^&*]$/m)) {return message.reply('Your custom prefix contains some *wonky* characters. Please use only alphanumerics and basic symbols.');}
tguild.prefix = ['c', 'clear', 'n', 'none'].includes(np.trim().toLowerCase()) ? '' : np;
tguild.save();
}
};

@ -17,9 +17,9 @@ module.exports = {
if (['view', 'v'].includes(args[0].trim().toLocaleLowerCase())) {return message.reply(
tguild.staffrole.length
? message.guild.roles.cache.has(tguild.staffrole)
? `\`People with the ${message.guild.roles.cache.get(tguild.staffrole).name}\` role can edit my setting here.`
? `\`people with the ${message.guild.roles.cache.get(tguild.staffrole).name}\` role can edit my setting here.`
: `I have a role stored for this server, but it doesn't seem to exist anymore, so only admins can edit my settings right now.`
: 'Only admins may edit settings in this server.'
: 'only admins may edit settings in this server.'
);}
let role = !['c', 'clear', 'n', 'none'].includes(args[0].trim().toLowerCase()) ? message.mentions.roles.size ? message.mentions.roles.first() : message.guild.roles.cache.has(args[0]) ? message.guild.roles.cache.get(args[0]) : null : 'c';
@ -28,17 +28,17 @@ module.exports = {
if (role === "c") {
tguild.staffrole = '';
tguild.save();
return message.reply("Got it, only admins can edit my settings in this server.");
return message.reply("got it, only admins can edit my settings in this server.");
} else {
tguild.staffrole = role.id;
tguild.save();
let upm = message.reply("Sure thing!");
let upm = message.reply("sure thing!");
await require('../util/wait')(1750);
return upm.edit(new Discord.MessageEmbed()
.setAuthor('Staff role updated!', message.author.avatarURL())
.setDescription(`<@${tguild.staffrole}> can now edit my settings in this server.`)
.addField('Auditing Admin', message.member.displayName, true)
.addField('Role-Holders', `${message.guild.members.cache.filter(m => m.roles.cache.has(tguild.staffrole) && !client.users.cache.get(m.id).bot)}+ members have this role`)
.addField('Auditing Admin', `<@${message.member.id}>`, true)
.addField('Role-Holders', `${message.guild.members.cache.filter(m => m.roles.cache.has(tguild.staffrole) && !client.users.cache.get(m.id).bot)}+ members have this role`, true)
.setColor('c375f0')
.setFooter('Natsuki', client.user.avatarURL())
.setTimestamp()

Loading…
Cancel
Save