diff --git a/src/postQuoteToSlack.js b/src/postQuoteToSlack.js index 21cc2c8..da8d623 100644 --- a/src/postQuoteToSlack.js +++ b/src/postQuoteToSlack.js @@ -1,5 +1,3 @@ -const {compose} = require('folktale/core/lambda'); - const buildPostMessageParams = (channelIdWhereToPostQuote, quote) => { return { channel: channelIdWhereToPostQuote, @@ -7,15 +5,17 @@ const buildPostMessageParams = (channelIdWhereToPostQuote, quote) => { }; }; -const postInSlack = (slackClient, channelIdWhereToPostQuote, quote) => compose( - slackClient.chat.postMessage, - buildPostMessageParams.bind(null, channelIdWhereToPostQuote) -)(quote); +const postInSlack = (slackClient, channelIdWhereToPostQuote, quote) => { + const messageParams = buildPostMessageParams(channelIdWhereToPostQuote, quote); + + return slackClient.chat.postMessage(messageParams); +}; module.exports = ({slackClient, logger, config, quotes, findQuoteOfTheDay}) => { const {channelIdWhereToPostQuote} = config; + const currentDate = new Date(); - return findQuoteOfTheDay(new Date(), quotes) + return findQuoteOfTheDay(currentDate, quotes) .chain((quote) => postInSlack(slackClient, channelIdWhereToPostQuote, quote) .then(logger.log) .catch(logger.error)