Update close.js
This commit is contained in:
1 parent
7234ec728c
commit
436586117c
1 file changed
+17
-25
+17
-25
@@ -18,6 +18,7 @@ const close1 = new Discord.RichEmbed()
|
|||||||
.setFooter("Your request will be avoided in 20 seconds")
|
.setFooter("Your request will be avoided in 20 seconds")
|
||||||
.setColor(bot.settings.colour)
|
.setColor(bot.settings.colour)
|
||||||
|
|
||||||
|
|
||||||
message.channel.send({embed: close1}).then(m => {
|
message.channel.send({embed: close1}).then(m => {
|
||||||
message.channel.awaitMessages(response => response.content === `confirm`, {
|
message.channel.awaitMessages(response => response.content === `confirm`, {
|
||||||
max: 1,
|
max: 1,
|
||||||
@@ -25,30 +26,22 @@ message.channel.send({embed: close1}).then(m => {
|
|||||||
errors: ['time'],
|
errors: ['time'],
|
||||||
|
|
||||||
}).then((collected) => {
|
}).then((collected) => {
|
||||||
const uID = message.author // Grabs
|
const log = message.guild.channels.find(channel => channel.name === bot.settings.Transcript_Logs)
|
||||||
const reason = args.join(" ") || "No Reason Provided."; //
|
const uID = message.author
|
||||||
const name = message.channel.name; // channel name
|
const reason = args.join(" ") || "No Reason Provided.";
|
||||||
const log = message.guild.channels.find(channel => channel.name === bot.settings.Transcript_Logs);
|
const name = message.channel.name;
|
||||||
const c = message.channel;
|
const c = message.channel;
|
||||||
|
message.channel.send(`Your ticket is currently closing`)
|
||||||
|
|
||||||
const closingEmbed = new Discord.RichEmbed()
|
.then(() => {
|
||||||
.setColor(bot.settings.colour)
|
|
||||||
.setDescription(`**${uID}** ${Ticket_Closing}`)
|
|
||||||
message.channel.send(closingEmbed).then(() => {
|
|
||||||
|
|
||||||
const embed = new Discord.RichEmbed()
|
const embed1 = new Discord.RichEmbed()
|
||||||
.setColor(bot.settings.colour)
|
|
||||||
.addField("Ticket Author", uID, true)
|
|
||||||
.addField("Closed By", message.author.tag, true)
|
|
||||||
.addField("Reason", reason, true)
|
|
||||||
|
|
||||||
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", uID, true)
|
.addField("Ticket Author", uID)
|
||||||
.addField("Closed By", message.author.tag, true)
|
.addField("Closed By", message.author.tag)
|
||||||
.addField("Reason", reason, true)
|
.addField("Reason", reason)
|
||||||
message.channel.fetchMessages({ limit: 100 })
|
message.channel.fetchMessages({ limit: 100 })
|
||||||
|
|
||||||
.then(msgs => {
|
.then(msgs => {
|
||||||
@@ -59,15 +52,13 @@ message.channel.send({embed: close1}).then(m => {
|
|||||||
const output = merged.reduce((out, msg) => {
|
const output = merged.reduce((out, msg) => {
|
||||||
out += `[${message.createdAt}] ${message.author.tag}: ${message.cleanContent ? message.cleanContent.replace(/\n/g, '\r\n') : ''}\r\n`;
|
out += `[${message.createdAt}] ${message.author.tag}: ${message.cleanContent ? message.cleanContent.replace(/\n/g, '\r\n') : ''}\r\n`;
|
||||||
return out;
|
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(transcriptembed).catch(console.error);
|
return log.send(embed1).catch(console.error);
|
||||||
|
})
|
||||||
})
|
});
|
||||||
});
|
})
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
m.edit('Close ticket request, timedout').then(m2 => {
|
m.edit('Close ticket request, timedout').then(m2 => {
|
||||||
@@ -96,6 +87,7 @@ console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
exports.help = {
|
exports.help = {
|
||||||
name: bot.settings.Close_Command,
|
name: bot.settings.Close_Command,
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user