mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-09-02 16:41:25 +03:00
Finished web archives, added suppor for custom emoji for panel reaction, minor fixes
This commit is contained in:
@@ -8,7 +8,9 @@
|
||||
|
||||
const ChildLogger = require('leekslazylogger').ChildLogger;
|
||||
const log = new ChildLogger();
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const {
|
||||
MessageEmbed
|
||||
} = require('discord.js');
|
||||
const fs = require('fs');
|
||||
const archive = require('../modules/archive');
|
||||
|
||||
@@ -19,7 +21,10 @@ module.exports = {
|
||||
aliases: ['none'],
|
||||
example: 'close #ticket-17',
|
||||
args: false,
|
||||
async execute(client, message, args, {config, Ticket}) {
|
||||
async execute(client, message, args, {
|
||||
config,
|
||||
Ticket
|
||||
}) {
|
||||
|
||||
const guild = client.guilds.cache.get(config.guild);
|
||||
|
||||
@@ -127,7 +132,7 @@ module.exports = {
|
||||
} catch (e) {
|
||||
log.warn(`Could not create DM channel with ${u.tag}`);
|
||||
}
|
||||
|
||||
|
||||
|
||||
let res = {};
|
||||
const embed = new MessageEmbed()
|
||||
@@ -138,17 +143,16 @@ module.exports = {
|
||||
|
||||
if (fs.existsSync(`user/transcripts/text/${ticket.get('channel')}.txt`)) {
|
||||
embed.addField('Text transcript', 'See attachment');
|
||||
res.files = [
|
||||
{
|
||||
attachment: `user/transcripts/text/${ticket.get('channel')}.txt`,
|
||||
name: `ticket-${ticket.id}-${ticket.get('channel')}.txt`
|
||||
}
|
||||
];
|
||||
res.files = [{
|
||||
attachment: `user/transcripts/text/${ticket.get('channel')}.txt`,
|
||||
name: `ticket-${ticket.id}-${ticket.get('channel')}.txt`
|
||||
}];
|
||||
}
|
||||
|
||||
if (fs.existsSync(`user/transcripts/raw/${ticket.get('channel')}.log`))
|
||||
if (fs.existsSync(`user/transcripts/raw/${ticket.get('channel')}.log`))
|
||||
embed.addField('Web archive', `${await archive.export(Ticket, channel)}`);
|
||||
|
||||
|
||||
|
||||
if (embed.fields.length < 1)
|
||||
embed.setDescription(`No text transcripts or archive data exists for ticket ${ticket.id}`);
|
||||
|
||||
|
@@ -58,7 +58,8 @@ module.exports = {
|
||||
.setFooter(guild.name, guild.iconURL())
|
||||
); // send new panel
|
||||
|
||||
panel.react(config.panel.reaction); // add reaction
|
||||
let emoji = panel.guild.emojis.cache.get(config.panel.reaction) || config.panel.reaction;
|
||||
panel.react(emoji); // add reaction
|
||||
Setting.update({ value: message.channel.id }, { where: { key: 'panel_chan_id' }}); // update database
|
||||
Setting.update({ value: panel.id }, { where: { key: 'panel_msg_id' }}); // update database
|
||||
|
||||
|
@@ -91,7 +91,7 @@ module.exports = {
|
||||
let desc = closedTickets.rows[t].topic.substring(0, 30);
|
||||
let transcript = '';
|
||||
let c = closedTickets.rows[t].channel;
|
||||
if(fs.existsSync(`user/transcripts/text/${c}.txt`) || fs.existsSync(`user/transcripts/raw/${c}.log`))
|
||||
if(fs.existsSync(`user/transcripts/text/${c}.txt`) || config.transcripts.web.enabled)
|
||||
transcript = `\n> Type \`${config.prefix}transcript ${closedTickets.rows[t].id}\` to view.`;
|
||||
|
||||
closed.push(`> **#${closedTickets.rows[t].id}**: \`${desc}${desc.length > 20 ? '...' : ''}\`${transcript}`);
|
||||
|
@@ -69,7 +69,7 @@ module.exports = {
|
||||
|
||||
|
||||
const BASE_URL = config.transcripts.web.server;
|
||||
if (fs.existsSync(`user/transcripts/raw/${ticket.channel}.log`))
|
||||
if (config.transcripts.web.enabled)
|
||||
embed.addField('Web archive', `${BASE_URL}/${ticket.creator}/${ticket.channel}`);
|
||||
|
||||
if (embed.fields.length < 1)
|
||||
|
Reference in New Issue
Block a user