|
|
|
@ -67,13 +67,12 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
fetchReply: true
|
|
|
|
fetchReply: true
|
|
|
|
})) as Message;
|
|
|
|
})) as Message;
|
|
|
|
const options = {
|
|
|
|
const options = {
|
|
|
|
enabled: interaction.options.getString("enabled") as string | boolean | null,
|
|
|
|
enabled: interaction.options.getString("enabled")?.startsWith("yes") as boolean | null,
|
|
|
|
category: interaction.options.getChannel("category"),
|
|
|
|
category: interaction.options.getChannel("category"),
|
|
|
|
maxtickets: interaction.options.getNumber("maxticketsperuser"),
|
|
|
|
maxtickets: interaction.options.getNumber("maxticketsperuser"),
|
|
|
|
supportping: interaction.options.getRole("supportrole")
|
|
|
|
supportping: interaction.options.getRole("supportrole")
|
|
|
|
};
|
|
|
|
};
|
|
|
|
if (options.enabled !== null || options.category || options.maxtickets || options.supportping) {
|
|
|
|
if (options.enabled !== null || options.category || options.maxtickets || options.supportping) {
|
|
|
|
options.enabled = options.enabled === "yes" ? true : false;
|
|
|
|
|
|
|
|
if (options.category) {
|
|
|
|
if (options.category) {
|
|
|
|
let channel: GuildChannel | null;
|
|
|
|
let channel: GuildChannel | null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
@ -211,7 +210,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
types: data.tickets.types,
|
|
|
|
types: data.tickets.types,
|
|
|
|
customTypes: data.tickets.customTypes
|
|
|
|
customTypes: data.tickets.customTypes
|
|
|
|
};
|
|
|
|
};
|
|
|
|
while (true) {
|
|
|
|
let timedOut = false;
|
|
|
|
|
|
|
|
while (!timedOut) {
|
|
|
|
embed = new EmojiEmbed()
|
|
|
|
embed = new EmojiEmbed()
|
|
|
|
.setTitle("Tickets")
|
|
|
|
.setTitle("Tickets")
|
|
|
|
.setDescription(
|
|
|
|
.setDescription(
|
|
|
|
@ -276,7 +276,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
i = await m.awaitMessageComponent({ time: 300000 });
|
|
|
|
i = await m.awaitMessageComponent({ time: 300000 });
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
break;
|
|
|
|
timedOut = true;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
i.deferUpdate();
|
|
|
|
i.deferUpdate();
|
|
|
|
if ((i.component as MessageActionRowComponent).customId === "clearCategory") {
|
|
|
|
if ((i.component as MessageActionRowComponent).customId === "clearCategory") {
|
|
|
|
@ -312,7 +313,9 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
description: "Click the button below to speak to us privately"
|
|
|
|
description: "Click the button below to speak to us privately"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
];
|
|
|
|
];
|
|
|
|
while (true) {
|
|
|
|
let innerTimedOut = false;
|
|
|
|
|
|
|
|
let templateSelected = false;
|
|
|
|
|
|
|
|
while (!innerTimedOut && !templateSelected) {
|
|
|
|
const enabled = data.enabled && data.category !== null;
|
|
|
|
const enabled = data.enabled && data.category !== null;
|
|
|
|
await interaction.editReply({
|
|
|
|
await interaction.editReply({
|
|
|
|
embeds: [
|
|
|
|
embeds: [
|
|
|
|
@ -373,7 +376,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
i = await m.awaitMessageComponent({ time: 300000 });
|
|
|
|
i = await m.awaitMessageComponent({ time: 300000 });
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
break;
|
|
|
|
innerTimedOut = true;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((i.component as MessageActionRowComponent).customId === "template") {
|
|
|
|
if ((i.component as MessageActionRowComponent).customId === "template") {
|
|
|
|
i.deferUpdate();
|
|
|
|
i.deferUpdate();
|
|
|
|
@ -397,7 +401,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
])
|
|
|
|
])
|
|
|
|
]
|
|
|
|
]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
templateSelected = true;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
} else if ((i.component as MessageActionRowComponent).customId === "blank") {
|
|
|
|
} else if ((i.component as MessageActionRowComponent).customId === "blank") {
|
|
|
|
i.deferUpdate();
|
|
|
|
i.deferUpdate();
|
|
|
|
await interaction.channel!.send({
|
|
|
|
await interaction.channel!.send({
|
|
|
|
@ -411,7 +416,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
])
|
|
|
|
])
|
|
|
|
]
|
|
|
|
]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
templateSelected = true;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
} else if ((i.component as MessageActionRowComponent).customId === "custom") {
|
|
|
|
} else if ((i.component as MessageActionRowComponent).customId === "custom") {
|
|
|
|
await i.showModal(
|
|
|
|
await i.showModal(
|
|
|
|
new Discord.Modal()
|
|
|
|
new Discord.Modal()
|
|
|
|
@ -462,7 +468,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
(m) => m.customId === "modify"
|
|
|
|
(m) => m.customId === "modify"
|
|
|
|
);
|
|
|
|
);
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
break;
|
|
|
|
innerTimedOut = true;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (out.fields) {
|
|
|
|
if (out.fields) {
|
|
|
|
const title = out.fields.getTextInputValue("title");
|
|
|
|
const title = out.fields.getTextInputValue("title");
|
|
|
|
@ -485,9 +492,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
])
|
|
|
|
])
|
|
|
|
]
|
|
|
|
]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
templateSelected = true;
|
|
|
|
} else {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -498,18 +503,18 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
|
|
|
|
data.enabled = !data.enabled;
|
|
|
|
data.enabled = !data.enabled;
|
|
|
|
} else if ((i.component as MessageActionRowComponent).customId === "manageTypes") {
|
|
|
|
} else if ((i.component as MessageActionRowComponent).customId === "manageTypes") {
|
|
|
|
data = await manageTypes(interaction, data, m as Message);
|
|
|
|
data = await manageTypes(interaction, data, m as Message);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
await interaction.editReply({
|
|
|
|
await interaction.editReply({
|
|
|
|
embeds: [embed.setFooter({ text: "Message closed" })],
|
|
|
|
embeds: [embed.setFooter({ text: "Message timed out" })],
|
|
|
|
components: []
|
|
|
|
components: []
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
async function manageTypes(interaction: CommandInteraction, data: GuildConfig["tickets"], m: Message) {
|
|
|
|
async function manageTypes(interaction: CommandInteraction, data: GuildConfig["tickets"], m: Message) {
|
|
|
|
while (true) {
|
|
|
|
let timedOut = false;
|
|
|
|
|
|
|
|
let backPressed = false;
|
|
|
|
|
|
|
|
while (!timedOut && !backPressed) {
|
|
|
|
if (data.useCustom) {
|
|
|
|
if (data.useCustom) {
|
|
|
|
const customTypes = data.customTypes;
|
|
|
|
const customTypes = data.customTypes;
|
|
|
|
await interaction.editReply({
|
|
|
|
await interaction.editReply({
|
|
|
|
@ -622,7 +627,8 @@ async function manageTypes(interaction: CommandInteraction, data: GuildConfig["t
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
i = await m.awaitMessageComponent({ time: 300000 });
|
|
|
|
i = await m.awaitMessageComponent({ time: 300000 });
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
break;
|
|
|
|
timedOut = true;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (i.component.customId === "types") {
|
|
|
|
if (i.component.customId === "types") {
|
|
|
|
i.deferUpdate();
|
|
|
|
i.deferUpdate();
|
|
|
|
@ -700,7 +706,7 @@ async function manageTypes(interaction: CommandInteraction, data: GuildConfig["t
|
|
|
|
} catch {
|
|
|
|
} catch {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
data.customTypes = data.customTypes || [];
|
|
|
|
data.customTypes = data.customTypes ?? [];
|
|
|
|
if (!data.customTypes.includes(toAdd)) {
|
|
|
|
if (!data.customTypes.includes(toAdd)) {
|
|
|
|
data.customTypes.push(toAdd);
|
|
|
|
data.customTypes.push(toAdd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -717,7 +723,7 @@ async function manageTypes(interaction: CommandInteraction, data: GuildConfig["t
|
|
|
|
data.useCustom = true;
|
|
|
|
data.useCustom = true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
i.deferUpdate();
|
|
|
|
i.deferUpdate();
|
|
|
|
break;
|
|
|
|
backPressed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return data;
|
|
|
|
return data;
|
|
|
|
|