mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-22 15:53:08 +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 = [];
|
||||
let line,
|
||||
lineNumber = 0;
|
||||
let line;
|
||||
|
||||
const lineByLine = new Readlines(join(__dirname, raw));
|
||||
|
||||
// eslint-disable-next-line no-cond-assign
|
||||
while (line = lineByLine.next()) {
|
||||
|
||||
let message = JSON.parse(line.toString('ascii'));
|
||||
let index = data.messages.findIndex(m => m.id === message.id);
|
||||
if (index === -1) data.messages.push(message);
|
||||
else data.messages[index] = message;
|
||||
lineNumber++;
|
||||
}
|
||||
|
||||
data.ticket.messages = lineNumber;
|
||||
|
||||
let endpoint = config.transcripts.web.server;
|
||||
|
||||
if (endpoint[endpoint.length - 1] === '/') endpoint = endpoint.slice(0, -1);
|
||||
|
Loading…
Reference in New Issue
Block a user