8.4 DEV 1

Changed JSON to SQLlite
Added Suggestion Forums
Added /suggestadmin
This commit is contained in:
1tzEmerald committed 2025-09-20 23:09:22 +01:00
1 parent c6db929d12
commit a05d65099b
40 files changed
+1562 -1522

No files matched your search

+12 -29
View File
@@ -1,47 +1,30 @@
// SupportBot | Emerald Services
// Ticket ID Structure
const fs = require("fs");
const db = require("./Database")
class TicketNumberID {
static async pad() {
let num = await this.get();
let n = num + "";
await this.set(num + 1);
return n.length >= 4 ? n : new Array(4 - n.length + 1).join("0") + n;
let num = await this.get()
let n = num + ""
await this.set(num + 1)
return n.length >= 4 ? n : new Array(4 - n.length + 1).join("0") + n
}
static async get() {
let ticketnumberID = await JSON.parse(
fs.readFileSync("./Data/ticket-panel-id.json", "utf8")
);
if (!ticketnumberID.id) {
return this.set(0);
} else {
return ticketnumberID.id;
}
const row = db.getTicketPanel()
if (!row) return await this.set(0)
return row.id
}
static async set(value) {
let ticketnumberID = await JSON.parse(
fs.readFileSync("./Data/ticket-panel-id.json", "utf8")
);
ticketnumberID.id = value;
fs.writeFileSync(
"./Data/ticket-panel-id.json",
JSON.stringify(ticketnumberID, null, 4),
(err) => {
if (err) console.error(err);
}
);
return value;
db.saveTicketPanel(`panel-${value}`, "none")
return value
}
static async reset() {
return await this.set(0);
return await this.set(0)
}
}
module.exports = TicketNumberID;
module.exports = TicketNumberID