Fix writeFileSync data
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simon Giesel 2020-04-29 16:30:37 +02:00
parent 4e51dafdc0
commit e79053c834
2 changed files with 13 additions and 10 deletions

View file

@ -6,4 +6,7 @@ services:
restart: always restart: always
image: registry.cliffbreak.de/trellobot image: registry.cliffbreak.de/trellobot
environment: environment:
NODE_ENV: production NODE_ENV: production
volumes:
- './conf.json:/usr/src/app/conf.json'
- './auth:/usr/src/app/.auth'

View file

@ -14,7 +14,7 @@ const events = new Trello({
boards: conf.boardIDs, // array of Trello board IDs boards: conf.boardIDs, // array of Trello board IDs
key: auth.trelloKey, // your public Trello API key key: auth.trelloKey, // your public Trello API key
token: auth.trelloToken // your private Trello token for Trellobot 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 ** contentStrings? That way you can ping one role for new Moderation
** cards, and another role for new Event cards, for example. ** 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.enabledEvents) conf.enabledEvents = []
if (!conf.userIDs) conf.userIDs = {} if (!conf.userIDs) conf.userIDs = {}
if (!conf.realNames) conf.realNames = true if (!conf.realNames) conf.realNames = true
@ -316,25 +316,25 @@ events.on('updateCheckItemStateOnCard', (event, board) => {
events.on('maxId', (id) => { events.on('maxId', (id) => {
if (latestActivityID == id) return if (latestActivityID == id) return
latestActivityID = id 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 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 logEventFire = (event) => console.log(`${new Date(event.date).toUTCString()} - ${event.type} fired`)
const getEmbedBase = (event) => new Discord.RichEmbed() 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) .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()) .setTimestamp(event.hasOwnProperty(`date`) ? event.date : Date.now())
.setColor("#127ABD") .setColor("#127ABD")
// Converts Trello @username mentions in titles to Discord mentions, finds channel and role mentions, and mirros Discord user mentions outside the embed // 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) => { const convertMentions = (embed, event) => {
} }
// adds thumbanil and appends user mention to the end of the description, if possible // adds thumbanil and appends user mention to the end of the description, if possible
const addDiscordUserData = (embed, member) => { const addDiscordUserData = (embed, member) => {
if (conf.userIDs[member.username]) { if (conf.userIDs[member.username]) {