Update close.js
This commit is contained in:
1 parent
fc4d68be39
commit
7234ec728c
1 file changed
+33
-32
+33
-32
@@ -25,47 +25,48 @@ message.channel.send({embed: close1}).then(m => {
|
|||||||
errors: ['time'],
|
errors: ['time'],
|
||||||
|
|
||||||
}).then((collected) => {
|
}).then((collected) => {
|
||||||
const Ticket_Owner = message.author // Grabs
|
const uID = message.author // Grabs
|
||||||
const reason = args.join(" ") || "No Reason Provided."; //
|
const reason = args.join(" ") || "No Reason Provided."; //
|
||||||
const name = message.channel.name; // channel name
|
const name = message.channel.name; // channel name
|
||||||
const log = message.guild.channels.find(channel => channel.name === bot.settings.Transcript_Logs);
|
const log = message.guild.channels.find(channel => channel.name === bot.settings.Transcript_Logs);
|
||||||
const c = message.channel;
|
const c = message.channel;
|
||||||
|
|
||||||
const ClosingEmbed = new Discord.RichEmbed()
|
const closingEmbed = new Discord.RichEmbed()
|
||||||
.setColor(bot.settings.colour)
|
.setColor(bot.settings.colour)
|
||||||
.setDescription(`**${Ticket_Owner}** ${Ticket_Closing}`)
|
.setDescription(`**${uID}** ${Ticket_Closing}`)
|
||||||
message.channel.send(ClosingEmbed)
|
message.channel.send(closingEmbed).then(() => {
|
||||||
|
|
||||||
.then(() => {
|
const embed = new Discord.RichEmbed()
|
||||||
const embed = new Discord.RichEmbed()
|
.setColor(bot.settings.colour)
|
||||||
.setColor(bot.settings.colour)
|
.addField("Ticket Author", uID, true)
|
||||||
.addField("Ticket Author", Ticket_Owner, true)
|
.addField("Closed By", message.author.tag, true)
|
||||||
.addField("Closed By", message.author.tag, true)
|
.addField("Reason", reason, true)
|
||||||
.addField("Reason", reason, true)
|
|
||||||
|
|
||||||
const TranscriptMESSAGE = new Discord.RichEmbed()
|
const transcriptembed = new Discord.RichEmbed()
|
||||||
.setTitle(bot.settings.Transcript_Title)
|
.setTitle(bot.settings.Transcript_Title)
|
||||||
.setColor(bot.settings.colour)
|
.setColor(bot.settings.colour)
|
||||||
.setFooter(bot.settings.footer)
|
.setFooter(bot.settings.footer)
|
||||||
.addField("Ticket Author", Ticket_Owner, true)
|
.addField("Ticket Author", uID, true)
|
||||||
.addField("Closed By", message.author.tag, true)
|
.addField("Closed By", message.author.tag, true)
|
||||||
.addField("Reason", reason, true)
|
.addField("Reason", reason, true)
|
||||||
message.channel.fetchMessages({ limit: 100 })
|
message.channel.fetchMessages({ limit: 100 })
|
||||||
|
|
||||||
.then(msgs => {
|
.then(msgs => {
|
||||||
message.channel.fetchMessages({ limit: 100, before: msgs.last().id })
|
message.channel.fetchMessages({ limit: 100, before: msgs.last().id })
|
||||||
.then(msg => {
|
|
||||||
const merged = msgs.concat(msg);
|
.then(msg => {
|
||||||
const output = merged.reduce((out, msg) => {
|
const merged = msgs.concat(msg);
|
||||||
out += `[${message.createdAt}] ${message.author.tag}: ${message.cleanContent ? message.cleanContent.replace(/\n/g, '\r\n') : ''}\r\n`;
|
const output = merged.reduce((out, msg) => {
|
||||||
return out;
|
out += `[${message.createdAt}] ${message.author.tag}: ${message.cleanContent ? message.cleanContent.replace(/\n/g, '\r\n') : ''}\r\n`;
|
||||||
}, '');
|
return out;
|
||||||
|
}, '');
|
||||||
|
|
||||||
log.send({ files: [{ attachment: Buffer.from(output, 'utf8'), name: `${name}.txt` }] }).then(c.delete()).catch(console.error); // sends the file to logs
|
log.send({ files: [{ attachment: Buffer.from(output, 'utf8'), name: `${name}.txt` }] }).then(c.delete()).catch(console.error); // sends the file to logs
|
||||||
log.send(TranscriptMESSAGE).catch(console.error);
|
log.send(transcriptembed).catch(console.error);
|
||||||
})
|
|
||||||
});
|
})
|
||||||
})
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
|||||||
Reference in new issue
Block a user