finishing touches

This commit is contained in:
codepupper 2019-11-10 21:50:18 +01:00
parent f7fd3b99a4
commit 00d3ea2999
10 changed files with 196 additions and 3 deletions

View file

@ -3,6 +3,9 @@ const { table } = require('quick.db');
const Servers = new table('servers');
const Users = new table('users');
const Backend = new table('backend');
const Trello = require('trello');
const config = require('../config');
const trello = new Trello(config.trello.key, config.trello.token);
module.exports = {
name: 'message',
run: async (client, msg) => {
@ -39,6 +42,7 @@ module.exports = {
channel: msg.channel,
author: msg.author,
member: msg.member,
trello,
db: { users: Users, servers: Servers, backend: Backend },
utils: require('../utils'),
config: require('../config'),
@ -77,7 +81,23 @@ module.exports = {
timestamps.set(msg.author.id, now);
setTimeout(() => timestamps.delete(msg.author.id), cooldownAmount);
cmd.command(ctx).then(() => {}).catch(console.error);
cmd.command(ctx).then(() => {}).catch((err) => {
trello
.addCard(
cmd.name + ' | ' + err.message,
`Full Error:
${err}
Author: ${msg.author.tag} (${msg.author.id})
Server: ${msg.guild.name} (${msg.guild.id})`,
config.trello.boards.errors
)
.then((r) => {
trello.addLabelToCard(r.id, config.trello.labels.errors).catch((error) => console.log(error));
})
.catch((err) => console.log(err));
console.warn(err.message);
});
}
}
};