mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-09-02 16:41:25 +03:00
progress. archiving works (other than uploading to server)
This commit is contained in:
@@ -32,9 +32,9 @@ Type \`${config.prefix}new\` on the server to create a new ticket.`);
|
||||
|
||||
let ticket = await Ticket.findOne({ where: { channel: message.channel.id } });
|
||||
if(ticket)
|
||||
archive.addMessage(client, message);
|
||||
archive.add(client, message); // add message to archive
|
||||
|
||||
if (message.author.bot || message.author.id === client.user.id) return; // if bot, fuck off
|
||||
if (message.author.bot || message.author.id === client.user.id) return; // goodbye bots
|
||||
|
||||
|
||||
/**
|
||||
|
@@ -43,7 +43,8 @@ module.exports = {
|
||||
time: message.createdTimestamp,
|
||||
embeds: embeds,
|
||||
attachments: [...message.attachments.values()],
|
||||
deleted: true
|
||||
edited: message.edits.length > 1,
|
||||
deleted: true // delete the message
|
||||
}) + '\n');
|
||||
|
||||
}
|
||||
|
@@ -134,7 +134,7 @@ module.exports = {
|
||||
}
|
||||
});
|
||||
|
||||
require('../utils/archive').create(client, c); // create files
|
||||
// require('../utils/archive').create(client, c); // create files
|
||||
|
||||
let ping;
|
||||
switch (config.tickets.ping) {
|
||||
|
@@ -14,7 +14,7 @@ const fs = require('fs');
|
||||
const dtf = require('@eartharoid/dtf');
|
||||
|
||||
module.exports = {
|
||||
event: 'oUpdate',
|
||||
event: 'messageUpdate',
|
||||
async execute(client, [o, n], {Ticket}) {
|
||||
|
||||
if(!config.transcripts.web.enabled) return;
|
||||
@@ -29,29 +29,29 @@ module.exports = {
|
||||
|
||||
if (n.partial)
|
||||
try {
|
||||
await o.fetch();
|
||||
await n.fetch();
|
||||
} catch (err) {
|
||||
log.error(err);
|
||||
return;
|
||||
}
|
||||
|
||||
if(o === n) return;
|
||||
if(o.content === n.content) return; // apparently editing a message isn't the only thing that emits this event
|
||||
|
||||
let ticket = await Ticket.findOne({ where: { channel: o.channel.id } });
|
||||
let ticket = await Ticket.findOne({ where: { channel: n.channel.id } });
|
||||
if(!ticket) return;
|
||||
|
||||
let path = `user/transcripts/raw/${o.channel.id}.log`;
|
||||
let path = `user/transcripts/raw/${n.channel.id}.log`;
|
||||
let embeds = [];
|
||||
for (let embed in o.embeds)
|
||||
embeds.push(o.embeds[embed].toJSON());
|
||||
for (let embed in n.embeds)
|
||||
embeds.push(n.embeds[embed].toJSON());
|
||||
|
||||
fs.appendFileSync(path, JSON.stringify({
|
||||
id: o.id,
|
||||
author: o.author.id,
|
||||
content: o.content, // do not use cleanContent!
|
||||
time: o.createdTimestamp,
|
||||
id: n.id,
|
||||
author: n.author.id,
|
||||
content: n.content, // do not use cleanContent!
|
||||
time: n.createdTimestamp,
|
||||
embeds: embeds,
|
||||
attachments: [...o.attachments.values()],
|
||||
attachments: [...n.attachments.values()],
|
||||
edited: true
|
||||
}) + '\n');
|
||||
|
||||
|
Reference in New Issue
Block a user