From 12fc869d569739eb1bc04b70b0b3c9b7f74edfd3 Mon Sep 17 00:00:00 2001
From: Patrick Malouin
Date: Tue, 27 Feb 2024 14:59:02 -0500
Subject: [PATCH] fix: help message around qrafty points (#203)
* fix: help message around qrafty points
* fix: use bot name to craft regexp
---
src/messageHandlers/helpMessage.js | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/messageHandlers/helpMessage.js b/src/messageHandlers/helpMessage.js
index e1d7fe05..2f436c5e 100644
--- a/src/messageHandlers/helpMessage.js
+++ b/src/messageHandlers/helpMessage.js
@@ -14,11 +14,17 @@ const { RegExpPlusPlus } = require('../lib/regExpPlusPlus');
const HelpService = require('../lib/services/help');
module.exports = function help(robot) {
+ const bn = robot.name || 'hubot';
+
robot.respond(RegExpPlusPlus.getHelp(), HelpService.respondWithHelpGuidance);
robot.respond(
/(plusplus version|-v|--version)/i,
HelpService.respondWithVersion,
);
- robot.respond(/how much .*point.*/i, HelpService.tellHowMuchPointsAreWorth);
+ const howMuchRegexp = new RegExp(
+ `how much .*${bn} point.*`,
+ 'i',
+ );
+ robot.respond(howMuchRegexp, HelpService.tellHowMuchPointsAreWorth);
};