mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-09-02 08:41:25 +03:00
features
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
});
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @name DiscordTickets
|
||||
* @author eartharoid <contact@eartharoid.me>
|
||||
* @license GNU-GPLv3
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
const { version, homepage } = require('../../package.json');
|
||||
|
@@ -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'
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @name DiscordTickets
|
||||
* @author eartharoid <contact@eartharoid.me>
|
||||
* @license GNU-GPLv3
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
|
Reference in New Issue
Block a user