mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 08:13:09 +02:00
improved logging for closeall
This commit is contained in:
parent
3d2b3c12cb
commit
c12d5ba047
@ -7,15 +7,13 @@
|
|||||||
|
|
||||||
const Logger = require('leekslazylogger');
|
const Logger = require('leekslazylogger');
|
||||||
const log = new Logger();
|
const log = new Logger();
|
||||||
const {
|
const { MessageEmbed } = require('discord.js');
|
||||||
MessageEmbed
|
|
||||||
} = require('discord.js');
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const { join } = require('path');
|
const { join } = require('path');
|
||||||
const config = require(join(__dirname, '../../user/', require('../').config));
|
const config = require(join(__dirname, '../../user/', require('../').config));
|
||||||
const archive = require('../modules/archive');
|
const archive = require('../modules/archive');
|
||||||
|
|
||||||
// Similar to 'close' command, however it iterates through them.
|
// A slight modification to the 'close' command to allow multiple tickets to be closed at once
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'closeall',
|
name: 'closeall',
|
||||||
@ -196,12 +194,29 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
log.info(log.format(`${message.author.tag} closed ticket &7${id}&f`));
|
||||||
|
|
||||||
client.channels.fetch(channel)
|
client.channels.fetch(channel)
|
||||||
.then(c => c.delete()
|
.then(c => c.delete()
|
||||||
.then(o => log.info(`Deleted channel with name: '#${o.name}' <${o.id}>`))
|
.then(o => log.info(`Deleted channel with name: '#${o.name}' <${o.id}>`))
|
||||||
.catch(e => log.error(e)))
|
.catch(e => log.error(e)))
|
||||||
.catch(e => log.error(e));
|
.catch(e => log.error(e));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (config.logs.discord.enabled) {
|
||||||
|
let embed = new MessageEmbed()
|
||||||
|
.setColor(config.colour)
|
||||||
|
.setAuthor(message.author.username, message.author.displayAvatarURL())
|
||||||
|
.setTitle(`${tickets.length} ticket${tickets.length > 1 ? 's' : ''} closed (${config.prefix}closeall)`)
|
||||||
|
.addField('Closed by', message.author, true)
|
||||||
|
.setFooter(guild.name, guild.iconURL())
|
||||||
|
.setTimestamp();
|
||||||
|
|
||||||
|
if (users.length > 1)
|
||||||
|
embed.addField('Members', users.map(u => `<@${u}>`).join('\n'));
|
||||||
|
|
||||||
|
client.channels.cache.get(config.logs.discord.channel).send(embed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user