diff --git a/docker-compose.yml b/docker-compose.yml index 2b7f69b..e395306 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,4 +6,7 @@ services: restart: always image: registry.cliffbreak.de/trellobot environment: - NODE_ENV: production \ No newline at end of file + NODE_ENV: production + volumes: + - './conf.json:/usr/src/app/conf.json' + - './auth:/usr/src/app/.auth' \ No newline at end of file diff --git a/trellobot.js b/trellobot.js index b3b9fab..e83ef9c 100644 --- a/trellobot.js +++ b/trellobot.js @@ -14,7 +14,7 @@ const events = new Trello({ boards: conf.boardIDs, // array of Trello board IDs key: auth.trelloKey, // your public Trello API key token: auth.trelloToken // your private Trello token for Trellobot - } + } }) @@ -49,7 +49,7 @@ bot.on('ready', () => { ** contentStrings? That way you can ping one role for new Moderation ** cards, and another role for new Event cards, for example. */ - if (!conf.contentString) conf.contentString = "" + if (!conf.contentString) conf.contentString = "" if (!conf.enabledEvents) conf.enabledEvents = [] if (!conf.userIDs) conf.userIDs = {} if (!conf.realNames) conf.realNames = true @@ -316,25 +316,25 @@ events.on('updateCheckItemStateOnCard', (event, board) => { events.on('maxId', (id) => { if (latestActivityID == id) return latestActivityID = id - fs.writeFileSync('.latestActivityID', id) + fs.writeFileSync('.latestActivityID', id.toString()) }) -const send = (embed, content = ``) => conf.channel.send(`${content} ${conf.contentString}`, {embed:embed}).catch(err => console.error(err)) +const send = (embed, content = ``) => conf.channel.send(`${content} ${conf.contentString}`, { embed: embed }).catch(err => console.error(err)) const eventEnabled = (type) => conf.enabledEvents.length > 0 ? conf.enabledEvents.includes(type) : true const logEventFire = (event) => console.log(`${new Date(event.date).toUTCString()} - ${event.type} fired`) const getEmbedBase = (event) => new Discord.RichEmbed() - .setFooter(`${conf.guild.members.get(bot.user.id).displayName} • ${event.data.board.name} [${event.data.board.shortLink}]`, bot.user.displayAvatarURL) - .setTimestamp(event.hasOwnProperty(`date`) ? event.date : Date.now()) - .setColor("#127ABD") + .setFooter(`${conf.guild.members.get(bot.user.id).displayName} • ${event.data.board.name} [${event.data.board.shortLink}]`, bot.user.displayAvatarURL) + .setTimestamp(event.hasOwnProperty(`date`) ? event.date : Date.now()) + .setColor("#127ABD") // Converts Trello @username mentions in titles to Discord mentions, finds channel and role mentions, and mirros Discord user mentions outside the embed const convertMentions = (embed, event) => { - + } - + // adds thumbanil and appends user mention to the end of the description, if possible const addDiscordUserData = (embed, member) => { if (conf.userIDs[member.username]) {