mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +02:00
Update index.js
This commit is contained in:
parent
f077e605b8
commit
5693458e8d
33
index.js
33
index.js
@ -127,17 +127,19 @@ client.on('message', message => {
|
|||||||
if(message.author.bot) return;
|
if(message.author.bot) return;
|
||||||
if (message.channel.type === "dm") {
|
if (message.channel.type === "dm") {
|
||||||
if (message.author.id === client.user.id) return;
|
if (message.author.id === client.user.id) return;
|
||||||
if(config.useEmbeds) {
|
if(config.logDMs){
|
||||||
const embed = new Discord.RichEmbed()
|
if(config.useEmbeds) {
|
||||||
.setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL)
|
const embed = new Discord.RichEmbed()
|
||||||
.setTitle("DM Logger")
|
.setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL)
|
||||||
.addField("Username", message.author.tag, true)
|
.setTitle("DM Logger")
|
||||||
.addField("Message", message.content, true)
|
.addField("Username", message.author.tag, true)
|
||||||
.setFooter(`${client.guilds.get(config.guildID).name} / Ticket Bot\nDiscordTickets by Eartharoid`);
|
.addField("Message", message.content, true)
|
||||||
client.channels.get(config.logChannel).send({embed})
|
.setFooter(`${client.guilds.get(config.guildID).name} / Ticket Bot\nDiscordTickets by Eartharoid`);
|
||||||
} else {
|
client.channels.get(config.logChannel).send({embed})
|
||||||
client.channels.get(config.logChannel).send(`DM received from **${message.author.tag} (${message.author.id})** : \n\n\`\`\`${message.content}\`\`\``);
|
} else {
|
||||||
}
|
client.channels.get(config.logChannel).send(`DM received from **${message.author.tag} (${message.author.id})** : \n\n\`\`\`${message.content}\`\`\``);
|
||||||
|
}
|
||||||
|
} else { return };
|
||||||
|
|
||||||
}
|
}
|
||||||
if (message.channel.bot) return;
|
if (message.channel.bot) return;
|
||||||
@ -156,14 +158,19 @@ client.on('message', message => {
|
|||||||
client.commands.get(command).execute(message, args, config, version);
|
client.commands.get(command).execute(message, args, config, version);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
message.channel.send(`:x: **Oof!** An error occured whilst executing that command.`);
|
message.channel.send(`:x: **Oof!** An error occured whilst executing that command.\nThe issue has been reported.`);
|
||||||
|
console.log(leeks.colors.red(`[ERROR] An unknown error occured whilst executing '${command}' command`));
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
process.on('unhandledRejection', error => {
|
process.on('unhandledRejection', error => {
|
||||||
console.log(leeks.colors.yellow(`[WARN] An error was not caught`))
|
console.warn(leeks.colors.yellow(`[WARN] An error was not caught`))
|
||||||
console.error(leeks.colors.red(`[ERROR] Uncaught Promise Error: \n${error.stack}`));
|
console.error(leeks.colors.red(`[ERROR] Uncaught Promise Error: \n${error.stack}`));
|
||||||
});
|
});
|
||||||
|
process.on('exit', (code) => {
|
||||||
|
console.log(leeks.colors.yellow(`Disconected from Discord API`));
|
||||||
|
console.log(leeks.colors.yellow(`Exiting (${code})`));
|
||||||
|
});
|
||||||
|
|
||||||
client.login(config.token);
|
client.login(config.token);
|
||||||
|
Loading…
Reference in New Issue
Block a user