logger stuff
This commit is contained in:
Eartharoid
2019-05-05 14:31:21 +01:00
parent 524ebaa767
commit 537f59d496
9 changed files with 83 additions and 49 deletions

View File

@@ -1,6 +1,6 @@
const Discord = require('discord.js');
const config = require('../config.json');
const leeks = require('leeks.js');
const log = require(`../handlers/logger.js`);
module.exports = {
name: 'add',
description: 'Add a member to a ticket channel',

View File

@@ -1,6 +1,6 @@
const Discord = require('discord.js');
const config = require('../config.json');
const leeks = require('leeks.js');
const log = require(`../handlers/logger.js`);
module.exports = {
name: 'close',
description: 'Close a ticket',

View File

@@ -1,6 +1,6 @@
const Discord = require('discord.js');
const config = require('../config.json');
const leeks = require('leeks.js');
const log = require(`../handlers/logger.js`);
module.exports = {
name: 'example-command',
description: 'An example command',

View File

@@ -1,7 +1,7 @@
const Discord = require('discord.js');
const { version } = require('../package.json');
const config = require('../config.json');
const leeks = require('leeks.js');
const log = require(`../handlers/logger.js`);
module.exports = {
name: 'help',
description: 'Displays help menu',
@@ -47,7 +47,7 @@ module.exports = {
})
.catch(error => {
// console.error(`Could not send help DM to ${message.author.tag}.\n`, error);
console.log(leeks.colors.yellow(leeks.styles.bold(`[WARN] Could not DM help menu to ${message.author.tag}, sending to server channel instead`)));
log.warn(`Could not DM help menu to ${message.author.tag}, sending to server channel instead`);
message.channel.send(`:x: **Sorry!** There was an error whilst sending the help menu via DMs.`)
message.channel.send(data, { split: true })
});
@@ -92,7 +92,7 @@ module.exports = {
})
.catch(error => {
// console.error(`Could not send help DM to ${message.author.tag}.\n`, error);
console.log(leeks.colors.yellow(leeks.styles.bold(`[WARN] Could not DM help menu to ${message.author.tag}, sending to server channel instead`)));
log.warn(`Could not DM help menu to ${message.author.tag}, sending to server channel instead`);
message.channel.send(`:x: **Sorry!** There was an error whilst sending the help menu via DMs.`)
message.channel.send(data, { split: true })
});

View File

@@ -1,6 +1,6 @@
const Discord = require('discord.js');
const config = require('../config.json');
const leeks = require('leeks.js');
const log = require(`../handlers/logger.js`);
// const randomString = require('random-string');
module.exports = {
name: 'new',
@@ -25,13 +25,18 @@ module.exports = {
// special: false,
// });
let id = message.author.id.toString().substr(0,4) + message.author.discriminator;
let chan = `ticket-${id}`;
if(message.guild.channels.some(channel => chan.includes(channel.name))) {
if(config.useEmbeds){
const err1 = new Discord.RichEmbed()
.setColor("#E74C3C")
.setDescription(`:x: You already have an open ticket.`)
return message.channel.send(err1)
} else {
message.channel.send(`:x: You already have an open ticket.`)
}
// if(message.guild.channels.some(channel => `ticket-${id}`)) {
if(message.guild.channels.some(includes(`ticket-${id}`))) {
const err1 = new Discord.RichEmbed()
.setColor("#E74C3C")
.setDescription(`:x: You already have a ticket open.`)
return message.channel.send(err1)
};
message.guild.createChannel(`ticket-${id}`).then(async c => {
@@ -79,7 +84,7 @@ module.exports = {
// } else {
// client.channels.get(config.logChannel).send(`New ticket created by **${message.author.tag} (${message.author.id})**`);
// }
console.log(leeks.colors.cyan(`${message.author.tag} created a new ticket (#ticket-${id})`))
log.info(`${message.author.tag} created a new ticket (#ticket-${id})`)
// command ends here
},

View File

@@ -1,6 +1,6 @@
const Discord = require('discord.js');
const config = require('../config.json');
const leeks = require('leeks.js');
const log = require(`../handlers/logger.js`);
module.exports = {
name: 'ping',
description: 'Calculate latency',

View File

@@ -1,6 +1,6 @@
const Discord = require('discord.js');
const config = require('../config.json');
const leeks = require('leeks.js');
const log = require(`../handlers/logger.js`);
module.exports = {
name: 'remove',
description: 'Remove a member from a ticket',