Better finds

This commit is contained in:
Noah committed 2021-11-21 18:42:18 -06:00
1 parent 02394e310d
commit 7eb949f109
7 files changed
+82 -110

No files matched your search

+11 -12
View File
@@ -32,19 +32,18 @@ module.exports = new Command({
permission: "SEND_MESSAGES", permission: "SEND_MESSAGES",
async run(interaction) { async run(interaction) {
let SupportStaff = let SupportStaff = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find( (SupportTeam) =>
(SupportTeam) => SupportTeam.name === supportbot.Staff SupportTeam.name == supportbot.Staff ||
) || SupportTeam.id == supportbot.Staff
interaction.guild.roles.cache.find(
(SupportTeam) => SupportTeam.id === supportbot.Staff
); );
let Admins = let Admins = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find( (AdminUser) =>
(AdminUser) => AdminUser.name === supportbot.Admin AdminUser.name == supportbot.Admin || AdminUser.id == supportbot.Admin
) || );
interaction.guild.roles.cache.find( if (!SupportStaff || !Admins)
(AdminUser) => AdminUser.id === supportbot.Admin return interaction.reply(
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
); );
const NoPerms = new Discord.MessageEmbed() const NoPerms = new Discord.MessageEmbed()
+8 -12
View File
@@ -63,12 +63,10 @@ module.exports = new Command({
} }
) )
.then((collected) => { .then((collected) => {
let logChannel = let logChannel = interaction.guild.channels.cache.find(
interaction.guild.channels.cache.find( (channel) =>
(channel) => channel.name === supportbot.TranscriptLog channel.name === supportbot.TranscriptLog ||
) || channel.id === supportbot.TranscriptLog
interaction.guild.channels.cache.find(
(channel) => channel.id === supportbot.TranscriptLog
); );
let user = interaction.user; let user = interaction.user;
let reason = let reason =
@@ -149,12 +147,10 @@ module.exports = new Command({
} }
if (!supportbot.CloseConfirmation) { if (!supportbot.CloseConfirmation) {
let logChannel = let logChannel = interaction.guild.channels.cache.find(
interaction.guild.channels.cache.find( (channel) =>
(channel) => channel.name === supportbot.TranscriptLog channel.name === supportbot.TranscriptLog ||
) || channel.id === supportbot.TranscriptLog
interaction.guild.channels.cache.find(
(channel) => channel.id === supportbot.TranscriptLog
); );
let user = interaction.user; let user = interaction.user;
let reason = let reason =
+11 -12
View File
@@ -31,21 +31,20 @@ module.exports = new Command({
permission: "SEND_MESSAGES", permission: "SEND_MESSAGES",
async run(interaction) { async run(interaction) {
let SupportStaff = let SupportStaff = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find( (SupportTeam) =>
(SupportTeam) => SupportTeam.name === supportbot.Staff SupportTeam.name === supportbot.Staff ||
) || SupportTeam.id === supportbot.Staff
interaction.guild.roles.cache.find(
(SupportTeam) => SupportTeam.id === supportbot.Staff
); );
let Admins = let Admins = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find( (AdminUser) =>
(AdminUser) => AdminUser.name === supportbot.Admin AdminUser.name === supportbot.Admin || AdminUser.id === supportbot.Admin
) ||
interaction.guild.roles.cache.find(
(AdminUser) => AdminUser.id === supportbot.Admin
); );
if (!SupportStaff || !Admins)
return interaction.reply(
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
);
const NoPerms = new Discord.MessageEmbed() const NoPerms = new Discord.MessageEmbed()
.setTitle("Invalid Permissions!") .setTitle("Invalid Permissions!")
.setDescription( .setDescription(
+10 -13
View File
@@ -25,21 +25,18 @@ module.exports = new Command({
permission: "SEND_MESSAGES", permission: "SEND_MESSAGES",
async run(interaction) { async run(interaction) {
let SupportStaff = let SupportStaff = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find( (adminRole) =>
(adminRole) => adminRole.name === supportbot.Staff adminRole.name === supportbot.Staff || staffRole.id === supportbot.Staff
) ||
interaction.guild.roles.cache.find(
(staffRole) => staffRole.id === supportbot.Staff
); );
let AdminStaff = let AdminStaff = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find( (adminRole) =>
(adminRole) => adminRole.name === supportbot.Admin adminRole.name === supportbot.Admin || adminRole.id === supportbot.Admin
) || );
interaction.guild.roles.cache.find( if (!SupportStaff || !Admins)
(adminRole) => adminRole.id === supportbot.Admin return interaction.reply(
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
); );
let botCommands = ""; let botCommands = "";
botCommands += `**/${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`; botCommands += `**/${cmdconfig.HelpCommand}** ${cmdconfig.HelpCommandDesc}\n`;
botCommands += `**/${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`; botCommands += `**/${cmdconfig.InfoCommand}** ${cmdconfig.InfoCommandDesc}\n`;
+11 -12
View File
@@ -32,19 +32,18 @@ module.exports = new Command({
permission: "SEND_MESSAGES", permission: "SEND_MESSAGES",
async run(interaction) { async run(interaction) {
let SupportStaff = let SupportStaff = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find( (SupportTeam) =>
(SupportTeam) => SupportTeam.name === supportbot.Staff SupportTeam.name == supportbot.Staff ||
) || SupportTeam.id == supportbot.Staff
interaction.guild.roles.cache.find(
(SupportTeam) => SupportTeam.id === supportbot.Staff
); );
let Admins = let Admins = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find( (AdminUser) =>
(AdminUser) => AdminUser.name === supportbot.Admin AdminUser.name == supportbot.Admin || AdminUser.id == supportbot.Admin
) || );
interaction.guild.roles.cache.find( if (!SupportStaff || !Admins)
(AdminUser) => AdminUser.id === supportbot.Admin return interaction.reply(
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
); );
const NoPerms = new Discord.MessageEmbed() const NoPerms = new Discord.MessageEmbed()
+4 -6
View File
@@ -25,12 +25,10 @@ module.exports = new Command({
permission: "SEND_MESSAGES", permission: "SEND_MESSAGES",
async run(interaction) { async run(interaction) {
const suggestChannel = const suggestChannel = interaction.guild.channels.cache.find(
interaction.guild.channels.cache.find( (channel) =>
(channel) => channel.name === supportbot.SuggestionChannel channel.name === supportbot.SuggestionChannel ||
) || channel.id === supportbot.SuggestionChannel
interaction.guild.channels.cache.find(
(channel) => channel.id === supportbot.SuggestionChannel
); );
const NoChannel = new Discord.MessageEmbed() const NoChannel = new Discord.MessageEmbed()
+27 -43
View File
@@ -36,10 +36,9 @@ module.exports = new Command({
if ( if (
reactionUser.roles.cache.find( reactionUser.roles.cache.find(
(role) => role.name === supportbot.TicketBlackListRole (role) =>
) || role.name == supportbot.TicketBlackListRole ||
reactionUser.roles.cache.find( role.id == supportbot.TicketBlackListRole
(role) => role.id === supportbot.TicketBlackListRole
) )
) { ) {
return interaction return interaction
@@ -70,46 +69,33 @@ module.exports = new Command({
) { ) {
return interaction.reply({ embeds: [TicketExists] }); return interaction.reply({ embeds: [TicketExists] });
} }
const Staff = const Staff = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find( (SupportTeam) =>
(SupportTeam) => SupportTeam.name === supportbot.Staff SupportTeam.name === supportbot.Staff ||
) || SupportTeam.id === supportbot.Staff
interaction.guild.roles.cache.find(
(SupportTeam) => SupportTeam.id === supportbot.Staff
); );
const Admins = const Admins = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find( (AdminUser) =>
(AdminUser) => AdminUser.name === supportbot.Admin AdminUser.name === supportbot.Admin || AdminUser.id === supportbot.Admin
) ||
interaction.guild.roles.cache.find(
(AdminUser) => AdminUser.id === supportbot.Admin
); );
const DeptRole1 = const DeptRole1 = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find(
(DepartmentRole) => (DepartmentRole) =>
DepartmentRole.name === `${supportbot.DepartmentRole_1}` DepartmentRole.name === supportbot.DepartmentRole_1 ||
) || DepartmentRole.id === supportbot.DepartmentRole_1
interaction.guild.roles.cache.find(
(DepartmentRole) =>
DepartmentRole.id === `${supportbot.DepartmentRole_1}`
); );
const DeptRole2 = const DeptRole2 = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find(
(DepartmentRole) => (DepartmentRole) =>
DepartmentRole.name === `${supportbot.DepartmentRole_2}` DepartmentRole.name === supportbot.DepartmentRole_2 ||
) || DepartmentRole.id === supportbot.DepartmentRole_2
interaction.guild.roles.cache.find(
(DepartmentRole) =>
DepartmentRole.id === `${supportbot.DepartmentRole_2}`
); );
const DeptRole3 = const DeptRole3 = interaction.guild.roles.cache.find(
interaction.guild.roles.cache.find(
(DepartmentRole) => (DepartmentRole) =>
DepartmentRole.name === `${supportbot.DepartmentRole_3}` DepartmentRole.name === supportbot.DepartmentRole_3 ||
) || DepartmentRole.id === supportbot.DepartmentRole_3
interaction.guild.roles.cache.find( );
(DepartmentRole) => if (!Staff || !Admins || !DeptRole1 || !DeptRole2 || !DeptRole3)
DepartmentRole.id === `${supportbot.DepartmentRole_3}` return interaction.reply(
"Some roles seem to be missing!\nPlease check for errors when starting the bot."
); );
const Author = interaction.user; const Author = interaction.user;
const Everyone = interaction.guild.id; const Everyone = interaction.guild.id;
@@ -158,12 +144,10 @@ module.exports = new Command({
ticketChannel.permissionOverwrites.create(index, { VIEW_CHANNEL: false }); ticketChannel.permissionOverwrites.create(index, { VIEW_CHANNEL: false });
}); });
let TicketCategory = let TicketCategory = interaction.guild.channels.cache.find(
interaction.guild.channels.cache.find( (category) =>
(category) => category.name === supportbot.TicketCategory category.name === supportbot.TicketCategory ||
) || category.id === supportbot.TicketCategory
interaction.guild.channels.cache.find(
(category) => category.id === supportbot.TicketCategory
); );
if (TicketCategory) { if (TicketCategory) {
ticketChannel.setParent(TicketCategory.id); ticketChannel.setParent(TicketCategory.id);