Bug fixes
This commit is contained in:
1 parent
23acc0926f
commit
e02ecf9553
2 files changed
+17
-13
No files matched your search
+15
-11
@@ -34,12 +34,12 @@ module.exports = new Command({
|
|||||||
let TicketData = await JSON.parse(
|
let TicketData = await JSON.parse(
|
||||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
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);
|
let User = interaction.guild.members.cache.get(interaction.user.id);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
supportbot.MaxAllowedTickets &&
|
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
|
.length >= supportbot.MaxAllowedTickets
|
||||||
) {
|
) {
|
||||||
return interaction.reply({
|
return interaction.reply({
|
||||||
@@ -77,11 +77,15 @@ module.exports = new Command({
|
|||||||
.setColor(supportbot.WarningColour);
|
.setColor(supportbot.WarningColour);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
await interaction.guild.channels.cache.find((ticketChannel) => {
|
await interaction.guild.channels.cache.find(
|
||||||
ticketChannel.name === `${supportbot.TicketPrefix}${ticketNumberID}`;
|
(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 Staff = await getRole(supportbot.Staff, interaction.guild);
|
||||||
const Admin = await getRole(supportbot.Admin, interaction.guild);
|
const Admin = await getRole(supportbot.Admin, interaction.guild);
|
||||||
@@ -186,13 +190,13 @@ module.exports = new Command({
|
|||||||
.setColor(supportbot.EmbedColour);
|
.setColor(supportbot.EmbedColour);
|
||||||
|
|
||||||
if (supportbot.TicketSubject === "embed") {
|
if (supportbot.TicketSubject === "embed") {
|
||||||
if (TicketSubject != "No Reason Provided.") {
|
if (TicketSubject !== "No Reason Provided.") {
|
||||||
TicketMessage.addFields({ name: "Reason", value: TicketSubject });
|
TicketMessage.addFields({ name: "Reason", value: TicketSubject });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (supportbot.TicketSubject === "description") {
|
if (supportbot.TicketSubject === "description") {
|
||||||
if (TicketSubject != "No Reason Provided.") {
|
if (TicketSubject !== "No Reason Provided.") {
|
||||||
await ticketChannel.setTopic(
|
await ticketChannel.setTopic(
|
||||||
`Reason: ${TicketSubject} - User ID: ${interaction.user.id} - Ticket: ${ticketChannel.name}`
|
`Reason: ${TicketSubject} - User ID: ${interaction.user.id} - Ticket: ${ticketChannel.name}`
|
||||||
);
|
);
|
||||||
@@ -260,7 +264,7 @@ module.exports = new Command({
|
|||||||
time: supportbot.Timeout * 60000,
|
time: supportbot.Timeout * 60000,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e.code == "INTERACTION_COLLECTOR_ERROR") {
|
if (e.code === "INTERACTION_COLLECTOR_ERROR") {
|
||||||
try {
|
try {
|
||||||
TicketData = await JSON.parse(
|
TicketData = await JSON.parse(
|
||||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
fs.readFileSync("./Data/TicketData.json", "utf8")
|
||||||
@@ -298,10 +302,10 @@ module.exports = new Command({
|
|||||||
title = supportbot.DepartmentTitle_3;
|
title = supportbot.DepartmentTitle_3;
|
||||||
}
|
}
|
||||||
|
|
||||||
ticketChannel.permissionOverwrites.edit(role.id, {
|
await ticketChannel.permissionOverwrites.edit(role.id, {
|
||||||
VIEW_CHANNEL: true,
|
VIEW_CHANNEL: true,
|
||||||
});
|
});
|
||||||
ticketChannel.permissionOverwrites.edit(Author.id, {
|
await ticketChannel.permissionOverwrites.edit(Author.id, {
|
||||||
SEND_MESSAGES: true,
|
SEND_MESSAGES: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -74,7 +74,7 @@ module.exports = new Event("ready", async (client) => {
|
|||||||
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`);
|
console.log(`\u001b[31m`, `――――――――――――――――――――――――――――――――――――――――――――`);
|
||||||
if (
|
if (
|
||||||
!supportbot.Guild ||
|
!supportbot.Guild ||
|
||||||
(await client.guilds.cache.size) !== 1 ||
|
client.guilds.cache.size !== 1 ||
|
||||||
(await client.guilds.cache.first().id) !== supportbot.Guild
|
(await client.guilds.cache.first().id) !== supportbot.Guild
|
||||||
) {
|
) {
|
||||||
console.log(
|
console.log(
|
||||||
@@ -203,7 +203,7 @@ module.exports = new Event("ready", async (client) => {
|
|||||||
);
|
);
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.log("Raw" + e);
|
console.log("Raw: " + e);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user