consistency

This commit is contained in:
David Ralph
2020-10-03 17:18:07 +01:00
parent b0ad6b7c88
commit 4c163443cd
23 changed files with 110 additions and 168 deletions

View File

@@ -33,8 +33,7 @@ module.exports.add = (message) => {
json = `user/transcripts/raw/entities/${message.channel.id}.json`;
let embeds = [];
for (let embed in message.embeds)
embeds.push({ ...message.embeds[embed] });
for (let embed in message.embeds) embeds.push({ ...message.embeds[embed] });
// message
fs.appendFileSync(raw, JSON.stringify({
@@ -104,8 +103,7 @@ module.exports.export = (Ticket, channel) => new Promise((resolve, reject) => {
let raw = `user/transcripts/raw/${channel.id}.log`,
json = `user/transcripts/raw/entities/${channel.id}.json`;
if (!config.transcripts.web.enabled || !fs.existsSync(raw) || !fs.existsSync(json))
return reject(false);
if (!config.transcripts.web.enabled || !fs.existsSync(raw) || !fs.existsSync(json)) return reject(false);
let data = JSON.parse(fs.readFileSync(json));
@@ -122,15 +120,12 @@ module.exports.export = (Ticket, channel) => new Promise((resolve, reject) => {
lineReader.eachLine(raw, line => {
let message = JSON.parse(line);
let index = data.messages.findIndex(m => m.id === message.id);
if (index === -1)
data.messages.push(message);
else
data.messages[index] = message;
if (index === -1) data.messages.push(message);
else data.messages[index] = message;
}, () => {
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);
endpoint += `/${data.ticket.creator}/${data.ticket.channel}/?key=${process.env.ARCHIVES_KEY}`;
@@ -157,7 +152,5 @@ module.exports.export = (Ticket, channel) => new Promise((resolve, reject) => {
return resolve(e);
});
});
})();
});

View File

@@ -16,8 +16,7 @@ const boxen = require('boxen');
const link = require('terminal-link');
module.exports = async () => {
if(!config.updater)
return;
if (!config.updater) return;
const json = await (await fetch('https://api.github.com/repos/eartharoid/DiscordTickets/releases')).json();
const update = json[0];
let notice = [];