From 3a229caaa59e7c17974e038f2a046bba01826a75 Mon Sep 17 00:00:00 2001 From: Matthew O'Keefe Date: Sat, 20 Nov 2021 05:50:59 -0600 Subject: [PATCH] Updating to && rng --- package-lock.json | 4 ++-- package.json | 2 +- src/index.js | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index c7ad4ab..4a9f8aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "hubot-plusplus-expanded-bonusly", - "version": "0.1.1", + "version": "0.1.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "hubot-plusplus-expanded-bonusly", - "version": "0.1.1", + "version": "0.1.2", "license": "MIT", "dependencies": { "@jest/globals": "^27.2.2", diff --git a/package.json b/package.json index aeaf1f6..aef616d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hubot-plusplus-expanded-bonusly", - "version": "0.1.1", + "version": "0.1.2", "description": "", "main": "index.js", "engines": { diff --git a/src/index.js b/src/index.js index 4777830..1b61179 100644 --- a/src/index.js +++ b/src/index.js @@ -211,12 +211,12 @@ module.exports = function (robot) { const user = await userService.getUser(e.event.sender.slackId); if (user.bonuslyDM === true || user.bonuslyDM === undefined) { let dm = `We sent <@${e.event.recipient.slackId}> ${e.response.result.amount_with_currency} via Bonusly. You now have ${e.response.result.giver.giving_balance_with_currency} left.`; - if (!user.bonuslyAmount || e.event.amount === 1 || Helpers.rngBoolean()) { - dm += `\n Did you know you could change the amount you send per ${robot.name} Point? Just DM @${robot.name} \`change my bonusly points setting\`,`; - dm += '\n I will ask you about how many points you\'d like to send per `++` you respond with a number. Bingo Bango Bongo, you\'re all set.'; + if ((!user.bonuslyAmount || e.event.amount === 1) && Helpers.rngBoolean()) { + dm += `\n\nDid you know you could change the amount you send per ${robot.name} Point?\n Just DM @${robot.name} \`change my bonusly points setting\`,`; + dm += '\nI will ask you about how many points you\'d like to send per `++` you respond with a number.\n :tada: Bingo Bango Bongo, you\'re all set.'; } - if (user.bonuslyDM === undefined || Helpers.rngBoolean()) { - dm += `\n Don't like these DMs about bonusly? Just DM @${robot.name} \`toggle dm about bonusly\` and we will turn off this DM.`; + if (user.bonuslyDM === undefined && Helpers.rngBoolean()) { + dm += `\n\nDon't like these DMs about bonusly?\nJust DM @${robot.name} \`toggle dm about bonusly\` and we will turn off this DM.`; } robot.messageRoom(e.event.sender.slackId, dm); }