Update TicketNumber.js

This commit is contained in:
ItzEmerald authored and GitHub committed 2020-01-29 18:57:22 +00:00
1 parent 1925deec90
commit e4b83f28c4
1 file changed
+8 -6
+8 -6
View File
@@ -1,3 +1,5 @@
const fs = require("fs");
class TicketId { class TicketId {
static pad(guildId) { static pad(guildId) {
@@ -12,14 +14,14 @@ class TicketId {
static get(guildId) { static get(guildId) {
let ticketIds = JSON.parse(fs.readFileSync("./ticketIds.json", "utf8")); let ticketIds = JSON.parse(fs.readFileSync("./storage/tickets.json", "utf8"));
if (!ticketIds[guildId]) { if (!ticketIds[guildId]) {
ticketIds[guildId] = { ticketIds[guildId] = {
id: 0 id: 0
} }
fs.writeFileSync("./ticketIds.json", JSON.stringify(ticketIds, null, 4), err => { fs.writeFileSync("./storage/tickets.json", JSON.stringify(ticketIds, null, 4), err => {
if (err) console.log(err); if (err) console.log(err);
}); });
@@ -32,13 +34,13 @@ class TicketId {
} }
static set(guildId, value) { static set(guildId, value) {
let ticketIds = JSON.parse(fs.readFileSync("./ticketIds.json", "utf8")); let ticketIds = JSON.parse(fs.readFileSync("./storage/tickets.json", "utf8"));
ticketIds[guildId] = { ticketIds[guildId] = {
id: value id: value
} }
fs.writeFileSync("./ticketIds.json", JSON.stringify(ticketIds, null, 4), err => { fs.writeFileSync("./storage/tickets.json", JSON.stringify(ticketIds, null, 4), err => {
if (err) console.log(err); if (err) console.log(err);
}); });
@@ -46,13 +48,13 @@ class TicketId {
} }
static reset(guildId) { static reset(guildId) {
let ticketIds = JSON.parse(fs.readFileSync("./ticketIds.json", "utf8")); let ticketIds = JSON.parse(fs.readFileSync("./storage/tickets.json", "utf8"));
ticketIds[guildId] = { ticketIds[guildId] = {
id: 0 id: 0
} }
fs.writeFileSync("./ticketIds.json", JSON.stringify(ticketIds, null, 4), err => { fs.writeFileSync("./storage/tickets.json", JSON.stringify(ticketIds, null, 4), err => {
if (err) console.log(err); if (err) console.log(err);
}); });