mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +02:00
Update archive.js
This commit is contained in:
parent
8a674c6f07
commit
36f263a07d
@ -117,23 +117,18 @@ module.exports.export = (Ticket, channel) => new Promise((resolve, reject) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
data.messages = [];
|
data.messages = [];
|
||||||
let line,
|
let line;
|
||||||
lineNumber = 0;
|
|
||||||
|
|
||||||
const lineByLine = new Readlines(join(__dirname, raw));
|
const lineByLine = new Readlines(join(__dirname, raw));
|
||||||
|
|
||||||
// eslint-disable-next-line no-cond-assign
|
// eslint-disable-next-line no-cond-assign
|
||||||
while (line = lineByLine.next()) {
|
while (line = lineByLine.next()) {
|
||||||
|
|
||||||
let message = JSON.parse(line.toString('ascii'));
|
let message = JSON.parse(line.toString('ascii'));
|
||||||
let index = data.messages.findIndex(m => m.id === message.id);
|
let index = data.messages.findIndex(m => m.id === message.id);
|
||||||
if (index === -1) data.messages.push(message);
|
if (index === -1) data.messages.push(message);
|
||||||
else data.messages[index] = message;
|
else data.messages[index] = message;
|
||||||
lineNumber++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data.ticket.messages = lineNumber;
|
|
||||||
|
|
||||||
let endpoint = config.transcripts.web.server;
|
let endpoint = config.transcripts.web.server;
|
||||||
|
|
||||||
if (endpoint[endpoint.length - 1] === '/') endpoint = endpoint.slice(0, -1);
|
if (endpoint[endpoint.length - 1] === '/') endpoint = endpoint.slice(0, -1);
|
||||||
|
Loading…
Reference in New Issue
Block a user