Bug fixes

This commit is contained in:
Noah committed 2022-02-04 17:55:02 -06:00
1 parent 23acc0926f
commit e02ecf9553
2 files changed
+17 -13

No files matched your search

+15 -11
View File
@@ -34,12 +34,12 @@ module.exports = new Command({
let TicketData = await JSON.parse(
fs.readFileSync("./Data/TicketData.json", "utf8")
);
const { getRole, getChannel, getCategory } = interaction.client;
const { getRole, getCategory } = interaction.client;
let User = interaction.guild.members.cache.get(interaction.user.id);
if (
supportbot.MaxAllowedTickets &&
TicketData.tickets.filter((t) => t.user == interaction.user.id && t.open)
TicketData.tickets.filter((t) => t.user === interaction.user.id && t.open)
.length >= supportbot.MaxAllowedTickets
) {
return interaction.reply({
@@ -77,11 +77,15 @@ module.exports = new Command({
.setColor(supportbot.WarningColour);
if (
await interaction.guild.channels.cache.find((ticketChannel) => {
ticketChannel.name === `${supportbot.TicketPrefix}${ticketNumberID}`;
})
await interaction.guild.channels.cache.find(
(ticketChannel) =>
ticketChannel.name === `${supportbot.TicketPrefix}${ticketNumberID}`
)
) {
return await interaction.reply({ embeds: [TicketExists] });
return await interaction.reply({
embeds: [TicketExists],
ephemeral: true,
});
}
const Staff = await getRole(supportbot.Staff, interaction.guild);
const Admin = await getRole(supportbot.Admin, interaction.guild);
@@ -186,13 +190,13 @@ module.exports = new Command({
.setColor(supportbot.EmbedColour);
if (supportbot.TicketSubject === "embed") {
if (TicketSubject != "No Reason Provided.") {
if (TicketSubject !== "No Reason Provided.") {
TicketMessage.addFields({ name: "Reason", value: TicketSubject });
}
}
if (supportbot.TicketSubject === "description") {
if (TicketSubject != "No Reason Provided.") {
if (TicketSubject !== "No Reason Provided.") {
await ticketChannel.setTopic(
`Reason: ${TicketSubject} - User ID: ${interaction.user.id} - Ticket: ${ticketChannel.name}`
);
@@ -260,7 +264,7 @@ module.exports = new Command({
time: supportbot.Timeout * 60000,
});
} catch (e) {
if (e.code == "INTERACTION_COLLECTOR_ERROR") {
if (e.code === "INTERACTION_COLLECTOR_ERROR") {
try {
TicketData = await JSON.parse(
fs.readFileSync("./Data/TicketData.json", "utf8")
@@ -298,10 +302,10 @@ module.exports = new Command({
title = supportbot.DepartmentTitle_3;
}
ticketChannel.permissionOverwrites.edit(role.id, {
await ticketChannel.permissionOverwrites.edit(role.id, {
VIEW_CHANNEL: true,
});
ticketChannel.permissionOverwrites.edit(Author.id, {
await ticketChannel.permissionOverwrites.edit(Author.id, {
SEND_MESSAGES: true,
});
+2 -2
View File
@@ -74,7 +74,7 @@ module.exports = new Event("ready", async (client) => {
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`);
if (
!supportbot.Guild ||
(await client.guilds.cache.size) !== 1 ||
client.guilds.cache.size !== 1 ||
(await client.guilds.cache.first().id) !== supportbot.Guild
) {
console.log(
@@ -203,7 +203,7 @@ module.exports = new Event("ready", async (client) => {
);
})
.catch((e) => {
console.log("Raw" + e);
console.log("Raw: " + e);
});
});
}