Template fixes and bugfixes (permission errs)

master
Kit Kasune 4 years ago
parent 5025614ff6
commit eead4ca8bb
  1. 2
      commands/clearwarnings.js
  2. 3
      commands/response.js
  3. 2
      commands/welcome.js
  4. 1
      events/message.js
  5. 24
      template.js

@ -13,7 +13,7 @@ module.exports = {
}, },
help: new Discord.MessageEmbed() help: new Discord.MessageEmbed()
.setTitle("Help -> Warn Clearing") .setTitle("Help -> Warn Clearing")
.setDescription("Clears the warnigns of a user") .setDescription("Clears the warnings of a user")
.addField("Syntax", "`clearwarnings <@user|userID>`") .addField("Syntax", "`clearwarnings <@user|userID>`")
.addField("Notice", "You must be a server administrator in order to use this command."), .addField("Notice", "You must be a server administrator in order to use this command."),
async execute(message, msg, args, cmd, prefix, mention, client) { async execute(message, msg, args, cmd, prefix, mention, client) {

@ -1,4 +1,5 @@
const Discord = require('discord.js'); const Discord = require('discord.js');
const GuildData = require('../models/guild'); const GuildData = require('../models/guild');
const Responses = require('../models/responses'); const Responses = require('../models/responses');
@ -24,7 +25,7 @@ module.exports = {
async execute(message, msg, args, cmd, prefix, mention, client) { async execute(message, msg, args, cmd, prefix, mention, client) {
if (!message.guild) {return message.reply("You must be in a server to use this command.");} if (!message.guild) {return message.reply("You must be in a server to use this command.");}
let tg = await GuildData.findOne({gid: message.guild.id}); let tg = await GuildData.findOne({gid: message.guild.id});
if (!tg && !['q', 'quick'].includes(args[0].toLowerCase()) && (tg.staffrole.length && !message.member.roles.cache.has(tg.staffrole)) && message.member.permissions.has("ADMINISTRATOR")) {return message.reply("you need to be staff or admin in this server in order to edit those settings.");} if (!['q', 'quick'].includes(args[0].toLowerCase()) && ((tg && tg.staffrole.length && !message.member.roles.cache.has(tg.staffrole))) && !message.member.permissions.has("ADMINISTRATOR")) {return message.reply("you need to be staff or admin in this server in order to edit those settings.");}
if (!args.length) {return message.channel.send(`Syntax: \`${prefix}response <new|edit|view|list|delete|test|quick>\``);} if (!args.length) {return message.channel.send(`Syntax: \`${prefix}response <new|edit|view|list|delete|test|quick>\``);}
if (args.length < 1) {return message.reply("You have to tell me what I'm supposed to find or save!");} if (args.length < 1) {return message.reply("You have to tell me what I'm supposed to find or save!");}

@ -23,7 +23,7 @@ module.exports = {
let tg = await GuildData.findOne({gid: message.guild.id}) ? await GuildData.findOne({gid: message.guild.id}) : new GuildData({gid: message.guild.id}); let tg = await GuildData.findOne({gid: message.guild.id}) ? await GuildData.findOne({gid: message.guild.id}) : new GuildData({gid: message.guild.id});
if (!args.length) {return message.channel.send(`Syntax: \`${prefix}welcome <set|clear|view|test>\``);} if (!args.length) {return message.channel.send(`Syntax: \`${prefix}welcome <set|clear|view|test>\``);}
if (['v', 'view', 'c', 'check'].includes(args[0].toLowerCase())) {} if (['v', 'view', 'c', 'check'].includes(args[0].toLowerCase())) {}
if ((!tg.staffrole.length || !message.member.roles.cache.has(tg.staffrole)) && !message.member.permissions.has("ADMINISTRATOR")) {return message.reply("You can't do that without staff or admin permissions, silly!");} if ((!tg || !tg.staffrole.length || !message.member.roles.cache.has(tg.staffrole)) && !message.member.permissions.has("ADMINISTRATOR")) {return message.reply("You can't do that without staff or admin permissions, silly!");}
if (['s', 'set'].includes(args[0].toLowerCase())) { if (['s', 'set'].includes(args[0].toLowerCase())) {
if (!args[1]) {return message.reply("You need to specify a channel for your welcome messages to be sent in!");} if (!args[1]) {return message.reply("You need to specify a channel for your welcome messages to be sent in!");}

@ -53,6 +53,7 @@ module.exports = async (client, message) => {
message.channel.startTyping(); message.channel.startTyping();
await wait(800); await wait(800);
message.channel.stopTyping(); message.channel.stopTyping();
if (command.meta && command.meta.guildOnly && !message.guild) {return message.channel.send("You must be in a server to use this command!");}
require('../util/oncommand')(message, msg, args, cmd, prefix, mention, client); require('../util/oncommand')(message, msg, args, cmd, prefix, mention, client);
return command.execute(message, msg, args, cmd, prefix, mention, client); return command.execute(message, msg, args, cmd, prefix, mention, client);
} }

@ -4,15 +4,11 @@ module.exports = {
name: "", name: "",
aliases: [], aliases: [],
meta: { meta: {
category: "", category: '',
perms: "", description: "",
staff: false, syntax: '` <>`',
vip: "", extra: null
serverPerms: [],
writtenBy: "",
serverOnly: false
}, },
tags: [],
help: new Discord.MessageEmbed() help: new Discord.MessageEmbed()
.setTitle("Help -> ") .setTitle("Help -> ")
.setDescription("") .setDescription("")
@ -30,15 +26,11 @@ module.exports = {
name: "", name: "",
aliases: [], aliases: [],
meta: { meta: {
category: "", category: '',
perms: "", description: "",
staff: false, syntax: '` <>`',
vip: "", extra: null
serverPerms: [],
writtenBy: "",
serverOnly: false
}, },
tags: [],
help: "", help: "",
async execute(message, msg, args, cmd, prefix, mention, client) { async execute(message, msg, args, cmd, prefix, mention, client) {
if (!args.length) {return message.channel.send(`Syntax: \`${prefix}\``);} if (!args.length) {return message.channel.send(`Syntax: \`${prefix}\``);}

Loading…
Cancel
Save