This commit is contained in:
David Ralph
2020-10-03 15:08:10 +01:00
parent 5ef7dc3fc4
commit b0ad6b7c88
32 changed files with 194 additions and 176 deletions

View File

@@ -1,9 +1,9 @@
/**
*
*
* @name DiscordTickets
* @author eartharoid <contact@eartharoid.me>
* @license GNU-GPLv3
*
*
*/
@@ -17,7 +17,7 @@ const fetch = require('node-fetch');
module.exports.add = (message) => {
if(message.type !== 'DEFAULT') return;
if (message.type !== 'DEFAULT') return;
if (config.transcripts.text.enabled) { // text transcripts
let path = `user/transcripts/text/${message.channel.id}.txt`,
@@ -100,15 +100,15 @@ module.exports.export = (Ticket, channel) => new Promise((resolve, reject) => {
channel: channel.id
}
});
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);
let data = JSON.parse(fs.readFileSync(json));
data.ticket = {
id: ticket.id,
name: channel.name,
@@ -125,7 +125,7 @@ module.exports.export = (Ticket, channel) => new Promise((resolve, reject) => {
if (index === -1)
data.messages.push(message);
else
data.messages[index] = message;
data.messages[index] = message;
}, () => {
let endpoint = config.transcripts.web.server;
@@ -156,8 +156,8 @@ module.exports.export = (Ticket, channel) => new Promise((resolve, reject) => {
log.warn(e);
return resolve(e);
});
});
});
})();
});

View File

@@ -1,9 +1,9 @@
/**
*
*
* @name DiscordTickets
* @author eartharoid <contact@eartharoid.me>
* @license GNU-GPLv3
*
*
*/
const { version, homepage } = require('../../package.json');

View File

@@ -1,9 +1,9 @@
/**
*
*
* @name DiscordTickets
* @author eartharoid <contact@eartharoid.me>
* @license GNU-GPLv3
*
*
*/
const ChildLogger = require('leekslazylogger').ChildLogger;
@@ -15,32 +15,28 @@ version = 'v' + version;
const boxen = require('boxen');
const link = require('terminal-link');
module.exports = () => {
module.exports = async () => {
if(!config.updater)
return;
fetch('https://api.github.com/repos/eartharoid/DiscordTickets/releases')
.then(res => res.json())
.then(json => {
const update = json[0];
let notice = [];
const json = await (await fetch('https://api.github.com/repos/eartharoid/DiscordTickets/releases')).json();
const update = json[0];
let notice = [];
if (version !== update.tag_name) {
log.notice(log.f(`There is an update available for Discord Tickets (${version} -> ${update.tag_name})`));
if (version !== update.tag_name) {
log.notice(log.f(`There is an update available for Discord Tickets (${version} -> ${update.tag_name})`));
notice.push(`&6You are currently using &c${version}&6, the latest is &a${update.tag_name}&6.`);
notice.push(`&6Download "&f${update.name}&6" from`);
notice.push(link('&6the GitHub releases page', 'https://github.com/eartharoid/DiscordTickets/releases/'));
notice.push(`&6You are currently using &c${version}&6, the latest is &a${update.tag_name}&6.`);
notice.push(`&6Download "&f${update.name}&6" from`);
notice.push(link('&6the GitHub releases page', 'https://github.com/eartharoid/DiscordTickets/releases/'));
console.log(
boxen(log.f(notice.join('\n')), {
padding: 1,
margin: 1,
align: 'center',
borderColor: 'yellow',
borderStyle: 'round'
})
);
}
});
console.log(
boxen(log.f(notice.join('\n')), {
padding: 1,
margin: 1,
align: 'center',
borderColor: 'yellow',
borderStyle: 'round'
})
);
}
};

View File

@@ -1,9 +1,9 @@
/**
*
*
* @name DiscordTickets
* @author eartharoid <contact@eartharoid.me>
* @license GNU-GPLv3
*
*
*/
module.exports = {