Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bde62a431f | ||
|
|
615a074540 | ||
|
|
09b335ac46 | ||
|
|
2701880c77 | ||
|
|
24c8f2fb38 | ||
|
|
c3ec158ac3 | ||
|
|
b3690222d0 | ||
|
|
4d7583785b |
No files matched your search
+9
-11
@@ -49,18 +49,19 @@ module.exports = new Command({
|
|||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
let tickets = await JSON.parse(
|
let tickets = await JSON.parse(
|
||||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
fs.readFileSync("./Data/TicketData.json", "utf8")
|
||||||
).tickets.find((t) => t.id === interaction.channel.id);
|
|
||||||
let TicketData = await tickets.tickets.findIndex(
|
|
||||||
(t) => t.id == ticketChannel.id
|
|
||||||
);
|
);
|
||||||
if (!TicketData) {
|
let TicketData = await tickets.tickets.findIndex(
|
||||||
|
(t) => t.id == interaction.channel.id
|
||||||
|
);
|
||||||
|
let ticket = tickets.tickets[TicketData];
|
||||||
|
if (TicketData == -1) {
|
||||||
const Exists = new Discord.MessageEmbed()
|
const Exists = new Discord.MessageEmbed()
|
||||||
.setTitle("No Ticket Found!")
|
.setTitle("No Ticket Found!")
|
||||||
.setDescription(`${supportbot.NoValidTicket}`)
|
.setDescription(`${supportbot.NoValidTicket}`)
|
||||||
.setColor(supportbot.WarningColour);
|
.setColor(supportbot.WarningColour);
|
||||||
return interaction.followUp({ embeds: [Exists] });
|
return interaction.followUp({ embeds: [Exists] });
|
||||||
}
|
}
|
||||||
let tUser = interaction.client.users.cache.get(TicketData.user);
|
let tUser = interaction.client.users.cache.get(ticket.user);
|
||||||
let transcriptChannel = await getChannel(
|
let transcriptChannel = await getChannel(
|
||||||
supportbot.TranscriptLog,
|
supportbot.TranscriptLog,
|
||||||
interaction.guild
|
interaction.guild
|
||||||
@@ -107,10 +108,7 @@ module.exports = new Command({
|
|||||||
"Ticket",
|
"Ticket",
|
||||||
`${interaction.channel.name} (${interaction.channel.id})`
|
`${interaction.channel.name} (${interaction.channel.id})`
|
||||||
)
|
)
|
||||||
.addField(
|
.addField("User", `${tUser}#${tUser.discriminator} (${tUser.id})`)
|
||||||
"User",
|
|
||||||
`${tUser.username}#${tUser.discriminator} (${tUser.id})`
|
|
||||||
)
|
|
||||||
.addField("Closed By", interaction.user.tag)
|
.addField("Closed By", interaction.user.tag)
|
||||||
.addField("Reason", reason);
|
.addField("Reason", reason);
|
||||||
const logEmbed = new Discord.MessageEmbed()
|
const logEmbed = new Discord.MessageEmbed()
|
||||||
@@ -162,8 +160,8 @@ module.exports = new Command({
|
|||||||
.catch(async (err) => {
|
.catch(async (err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
if (TicketData.subUsers) {
|
if (ticket.subUsers) {
|
||||||
TicketData.subUsers.forEach(async (subUser) => {
|
ticket.subUsers.forEach(async (subUser) => {
|
||||||
interaction.client.users.cache
|
interaction.client.users.cache
|
||||||
.get(subUser)
|
.get(subUser)
|
||||||
.send({ embeds: [transcriptEmbed], files: [file] });
|
.send({ embeds: [transcriptEmbed], files: [file] });
|
||||||
|
|||||||
+7
-3
@@ -246,9 +246,9 @@ module.exports = new Command({
|
|||||||
components: [row],
|
components: [row],
|
||||||
});
|
});
|
||||||
|
|
||||||
const filter = (i) => i.user.id === interaction.user.id;
|
|
||||||
let collector;
|
let collector;
|
||||||
try {
|
try {
|
||||||
|
const filter = (i) => i.user.id === interaction.user.id;
|
||||||
collector = await m.awaitMessageComponent({
|
collector = await m.awaitMessageComponent({
|
||||||
filter,
|
filter,
|
||||||
max: 1,
|
max: 1,
|
||||||
@@ -256,8 +256,11 @@ 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(
|
||||||
|
fs.readFileSync("./Data/TicketData.json", "utf8")
|
||||||
|
);
|
||||||
let ticket = await TicketData.tickets.findIndex(
|
let ticket = await TicketData.tickets.findIndex(
|
||||||
(t) => t.id == ticketChannel.id
|
(t) => t.id == ticketChannel.id
|
||||||
);
|
);
|
||||||
@@ -273,7 +276,8 @@ module.exports = new Command({
|
|||||||
"Your ticket has timed out. Please open a new one, and select a department."
|
"Your ticket has timed out. Please open a new one, and select a department."
|
||||||
);
|
);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
return await ticketChannel.delete();
|
return await ticketChannel.delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let role;
|
let role;
|
||||||
let title;
|
let title;
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
{
|
{
|
||||||
"id": 0,
|
|
||||||
"tickets": []
|
"tickets": []
|
||||||
}
|
}
|
||||||
@@ -1 +1,4 @@
|
|||||||
{"TicketPanelID":""}
|
{
|
||||||
|
"id": 0,
|
||||||
|
"TicketPanelID": ""
|
||||||
|
}
|
||||||
@@ -186,6 +186,7 @@ module.exports = new Event("ready", async (client) => {
|
|||||||
})
|
})
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
let data = {
|
let data = {
|
||||||
|
id: panelid.id,
|
||||||
TicketPanelID: `${r.id}`,
|
TicketPanelID: `${r.id}`,
|
||||||
};
|
};
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
|
|||||||
+14
-41
@@ -5,44 +5,31 @@ const fs = require("fs");
|
|||||||
|
|
||||||
class TicketNumberID {
|
class TicketNumberID {
|
||||||
static async pad() {
|
static async pad() {
|
||||||
let n = this.get() + "";
|
let num = await this.get();
|
||||||
let z = "0";
|
let n = num + "";
|
||||||
let width = 4;
|
await this.set(num + 1);
|
||||||
await this.set(this.get() + 1);
|
return n.length >= 4 ? n : new Array(4 - n.length + 1).join("0") + n;
|
||||||
return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static get() {
|
static async get() {
|
||||||
let ticketnumberID = JSON.parse(
|
let ticketnumberID = await JSON.parse(
|
||||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
fs.readFileSync("./Data/ticket-panel-id.json", "utf8")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!ticketnumberID.id) {
|
if (!ticketnumberID.id) {
|
||||||
ticketnumberID.id = 0;
|
return this.set(0);
|
||||||
|
|
||||||
fs.writeFileSync(
|
|
||||||
"./Data/TicketData.json",
|
|
||||||
JSON.stringify(ticketnumberID, null, 4),
|
|
||||||
(err) => {
|
|
||||||
if (err) console.error(err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
} else {
|
} else {
|
||||||
return ticketnumberID.id;
|
return ticketnumberID.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static set(value) {
|
static async set(value) {
|
||||||
let ticketnumberID = JSON.parse(
|
let ticketnumberID = await JSON.parse(
|
||||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
fs.readFileSync("./Data/ticket-panel-id.json", "utf8")
|
||||||
);
|
);
|
||||||
|
|
||||||
ticketnumberID.id = value;
|
ticketnumberID.id = value;
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
"./Data/TicketData.json",
|
"./Data/ticket-panel-id.json",
|
||||||
JSON.stringify(ticketnumberID, null, 4),
|
JSON.stringify(ticketnumberID, null, 4),
|
||||||
(err) => {
|
(err) => {
|
||||||
if (err) console.error(err);
|
if (err) console.error(err);
|
||||||
@@ -52,22 +39,8 @@ class TicketNumberID {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static reset() {
|
static async reset() {
|
||||||
let ticketnumberID = JSON.parse(
|
return await this.set(0);
|
||||||
fs.readFileSync("./Data/TicketData.json", "utf8")
|
|
||||||
);
|
|
||||||
|
|
||||||
ticketnumberID.id = 0;
|
|
||||||
|
|
||||||
fs.writeFileSync(
|
|
||||||
"./Data/TicketData.json",
|
|
||||||
JSON.stringify(ticketnumberID, null, 4),
|
|
||||||
(err) => {
|
|
||||||
if (err) console.error(err);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "supportbot",
|
"name": "supportbot",
|
||||||
"version": "7.4.0",
|
"version": "7.4.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "supportbot",
|
"name": "supportbot",
|
||||||
"version": "7.4.0",
|
"version": "7.4.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "^13.3.1",
|
"discord.js": "^13.3.1",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "supportbot",
|
"name": "supportbot",
|
||||||
"version": "7.4.0",
|
"version": "7.4.1",
|
||||||
"description": "SupportBot is an open-sourced support system for discord. It's completely free to use with high amounts of customization to match your own brand.",
|
"description": "SupportBot is an open-sourced support system for discord. It's completely free to use with high amounts of customization to match your own brand.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in new issue
Block a user