Update forceclose.js
This commit is contained in:
1 parent
bcf2df4bff
commit
fc4d68be39
1 file changed
+42
@@ -27,6 +27,48 @@ const outsideticket = new Discord.RichEmbed()
|
|||||||
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
|
if (!message.channel.name.startsWith(`ticket-`)) return message.channel.send({embed: outsideticket});
|
||||||
message.channel.delete();
|
message.channel.delete();
|
||||||
|
|
||||||
|
const Ticket_Owner = message.author // Grabs
|
||||||
|
const reason = args.join(" ") || "No Reason Provided."; //
|
||||||
|
const name = message.channel.name; // channel name
|
||||||
|
const log = message.guild.channels.find(channel => channel.name === bot.settings.Transcript_Logs);
|
||||||
|
const c = message.channel;
|
||||||
|
|
||||||
|
const ClosingEmbed = new Discord.RichEmbed()
|
||||||
|
.setColor(bot.settings.colour)
|
||||||
|
.setDescription(`**${Ticket_Owner}** ${Ticket_Closing}`)
|
||||||
|
message.channel.send(ClosingEmbed)
|
||||||
|
|
||||||
|
.then(() => {
|
||||||
|
const embed = new Discord.RichEmbed()
|
||||||
|
.setColor(bot.settings.colour)
|
||||||
|
.addField("Ticket Author", Ticket_Owner, true)
|
||||||
|
.addField("Closed By", message.author.tag, true)
|
||||||
|
.addField("Reason", reason, true)
|
||||||
|
|
||||||
|
const TranscriptMESSAGE = new Discord.RichEmbed()
|
||||||
|
.setTitle(bot.settings.Transcript_Title)
|
||||||
|
.setColor(bot.settings.colour)
|
||||||
|
.setFooter(bot.settings.footer)
|
||||||
|
.addField("Ticket Author", Ticket_Owner, true)
|
||||||
|
.addField("Closed By", message.author.tag, true)
|
||||||
|
.addField("Reason", reason, true)
|
||||||
|
message.channel.fetchMessages({ limit: 100 })
|
||||||
|
|
||||||
|
.then(msgs => {
|
||||||
|
message.channel.fetchMessages({ limit: 100, before: msgs.last().id })
|
||||||
|
.then(msg => {
|
||||||
|
const merged = msgs.concat(msg);
|
||||||
|
const output = merged.reduce((out, msg) => {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(TranscriptMESSAGE).catch(console.error);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Forceclose_Command}`)
|
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Forceclose_Command}`)
|
||||||
|
|
||||||
const CMDLog = new Discord.RichEmbed()
|
const CMDLog = new Discord.RichEmbed()
|
||||||
|
|||||||
Reference in new issue
Block a user