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
+98 -126

No files matched your search

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