Revert "Added extremely basic multi-role support"

This reverts commit 1c226e8f7e.
This commit is contained in:
Isaac (eartharoid) 2020-09-20 22:01:10 +01:00
parent 1c226e8f7e
commit 585be0e7d5
11 changed files with 15 additions and 32 deletions

View File

@ -9,7 +9,6 @@
const { MessageEmbed } = require('discord.js');
const ChildLogger = require('leekslazylogger').ChildLogger;
const log = new ChildLogger();
const utils = require('../modules/utils');
module.exports = {
name: 'add',
@ -53,7 +52,7 @@ module.exports = {
}
}
if(message.author.id !== ticket.creator && !utils.isStaff(message.member))
if(message.author.id !== ticket.creator && !message.member.roles.cache.has(config.staff_role))
return message.channel.send(
new MessageEmbed()
.setColor(config.err_colour)

View File

@ -13,7 +13,6 @@ const {
} = require('discord.js');
const fs = require('fs');
const archive = require('../modules/archive');
const utils = require('../modules/utils');
module.exports = {
name: 'close',
@ -67,7 +66,7 @@ module.exports = {
return message.channel.send(notTicket);
}
if (message.author.id !== ticket.creator && !utils.isStaff(message.member))
if (message.author.id !== ticket.creator && !message.member.roles.cache.has(config.staff_role))
return channel.send(
new MessageEmbed()
.setColor(config.err_colour)

View File

@ -65,7 +65,7 @@ module.exports = {
return message.channel.send(notTicket);
}
if (message.author.id !== ticket.creator && !utils.isStaff(message.member))
if (message.author.id !== ticket.creator && !message.member.roles.cache.has(config.staff_role))
return channel.send(
new MessageEmbed()
.setColor(config.err_colour)

View File

@ -22,13 +22,13 @@ module.exports = {
const guild = client.guilds.cache.get(config.guild);
const supportRole = guild.roles.cache.get(config.staff_roles[0]);
const supportRole = guild.roles.cache.get(config.staff_role);
if (!supportRole)
return message.channel.send(
new MessageEmbed()
.setColor(config.err_colour)
.setTitle(':x: **Error**')
.setDescription(`${config.name} has not been set up correctly. Could not find a 'support team' role with the id \`${config.staff_roles[0]}\``)
.setDescription(`${config.name} has not been set up correctly. Could not find a 'support team' role with the id \`${config.staff_role}\``)
.setFooter(guild.name, guild.iconURL())
);
@ -140,7 +140,7 @@ module.exports = {
let ping;
switch (config.tickets.ping) {
case 'staff':
ping = `<@&${config.staff_roles[0]}>,\n`;
ping = `<@&${config.staff_role}>,\n`;
break;
case false:
ping = '';

View File

@ -9,7 +9,6 @@
const { MessageEmbed } = require('discord.js');
const ChildLogger = require('leekslazylogger').ChildLogger;
const log = new ChildLogger();
const utils = require('../modules/utils');
module.exports = {
name: 'remove',
@ -53,7 +52,7 @@ module.exports = {
}
}
if(message.author.id !== ticket.creator && !utils.isStaff(message.member))
if(message.author.id !== ticket.creator && !message.member.roles.cache.has(config.staff_role))
return message.channel.send(
new MessageEmbed()
.setColor(config.err_colour)

View File

@ -8,7 +8,6 @@
const { MessageEmbed } = require('discord.js');
const fs = require('fs');
const utils = require('../modules/utils');
module.exports = {
name: 'tickets',
@ -21,13 +20,13 @@ module.exports = {
const guild = client.guilds.cache.get(config.guild);
const supportRole = guild.roles.cache.get(config.staff_roles[0]);
const supportRole = guild.roles.cache.get(config.staff_role);
if (!supportRole)
return message.channel.send(
new MessageEmbed()
.setColor(config.err_colour)
.setTitle(':x: **Error**')
.setDescription(`${config.name} has not been set up correctly. Could not find a 'support team' role with the id \`${config.staff_roles[0]}\``)
.setDescription(`${config.name} has not been set up correctly. Could not find a 'support team' role with the id \`${config.staff_role}\``)
.setFooter(guild.name, guild.iconURL())
);
@ -35,7 +34,7 @@ module.exports = {
let user = message.mentions.users.first() || guild.members.cache.get(args[0]);
if(user) {
if(!utils.isStaff(message.member))
if(!message.member.roles.cache.has(config.staff_role))
return message.channel.send(
new MessageEmbed()
.setColor(config.err_colour)

View File

@ -10,7 +10,6 @@ const fs = require('fs');
const {
MessageEmbed
} = require('discord.js');
const utils = require('../modules/utils');
module.exports = {
name: 'transcript',
@ -42,7 +41,7 @@ module.exports = {
.setFooter(guild.name, guild.iconURL())
);
if (message.author.id !== ticket.creator && !utils.isStaff(message.member))
if (message.author.id !== ticket.creator && !message.member.roles.cache.has(config.staff_role))
return message.channel.send(
new MessageEmbed()
.setColor(config.err_colour)

View File

@ -34,13 +34,13 @@ module.exports = {
let channel = r.message.channel;
const supportRole = channel.guild.roles.cache.get(config.staff_roles[0]);
const supportRole = channel.guild.roles.cache.get(config.staff_role);
if (!supportRole)
return channel.send(
new MessageEmbed()
.setColor(config.err_colour)
.setTitle(':x: **Error**')
.setDescription(`${config.name} has not been set up correctly. Could not find a 'support team' role with the id \`${config.staff_roles[0]}\``)
.setDescription(`${config.name} has not been set up correctly. Could not find a 'support team' role with the id \`${config.staff_role}\``)
.setFooter(channel.guild.name, channel.guild.iconURL())
);
@ -144,7 +144,7 @@ module.exports = {
let ping;
switch (config.tickets.ping) {
case 'staff':
ping = `<@&${config.staff_roles[0]}>,\n`;
ping = `<@&${config.staff_role}>,\n`;
break;
case false:
ping = '';

View File

@ -23,7 +23,6 @@ const client = new Discord.Client({
client.events = new Discord.Collection();
client.commands = new Discord.Collection();
client.cooldowns = new Discord.Collection();
client.config = config;
const utils = require('./modules/utils');
const leeks = require('leeks.js');

View File

@ -14,16 +14,5 @@ module.exports = {
*/
plural(word, num) {
return num !== 1 ? word + 's' : word;
},
isStaff(member) {
let staff = false;
member.client.config.staff_roles.forEach(id => {
if (member.roles.cache.has(id))
staff = true;
});
return staff;
}
};

View File

@ -36,7 +36,7 @@ module.exports = {
cooldown: 3,
guild: '', // ID of your guild
staff_roles: [''], // ID of your Support Team role
staff_role: '', // ID of your Support Team role
tickets: {
category: '', // ID of your tickets category