From d76e41fdfe4e6b2bc4a29b1ae55309abc7c5357b Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 12 Oct 2018 18:35:30 +0300 Subject: [PATCH] Fix --- src/cuteme.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cuteme.js b/src/cuteme.js index d45e1aa..84110aa 100644 --- a/src/cuteme.js +++ b/src/cuteme.js @@ -17,7 +17,7 @@ module.exports = function (robot) { const CUTIES_LIMIT = parseInt(process.env.CUTIES_LIMIT, 10) || 5 robot.respond(/pug me/i, async (msg) => { - await nFetch(`${SERVICE_URL}/breed/pug/images/random`) + await nFetch(`${PUGME_SERVICE}/breed/pug/images/random`) .then(res => res.json()) .then(json => msg.send(json.message)) .catch(err => robot.logger.error(`Failed to request a pug: ${err}`)) @@ -26,12 +26,13 @@ module.exports = function (robot) { robot.respond(/pug bomb( (\d+))?/i, async (msg) => { const count = msg.match[2] || 5 - if (count > PUGS_LIMIT) { - msg.send(`The maximum number of pugs is limited to ${PUGS_LIMIT}`) + if (count > CUTIES_LIMIT) { + msg.send(`The maximum number of pugs is limited to ${CUTIES_LIMIT}`) return + } - await nFetch(`${SERVICE_URL}/breed/pug/images/random/${count}`) + await nFetch(`${PUGME_SERVICE}/breed/pug/images/random/${count}`) .then(res => res.json()) .then(json => Array.from(json.message).map((pug) => msg.send(pug))) .catch(err => robot.logger.error(`Failed to request ${count} pugs: ${err}`))