From 3519bde854593d6cc075b8425290978f8a512269 Mon Sep 17 00:00:00 2001 From: Ayushmann Ghodture <142772501+Ayushmann13479@users.noreply.github.com> Date: Sun, 7 Jun 2026 15:20:47 +0530 Subject: [PATCH 1/3] Fix #473: Add Docs parser with new ServiceNow URL format Adds a parser for ServiceNow documentation links. --- Parsers/Docs.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Parsers/Docs.js diff --git a/Parsers/Docs.js b/Parsers/Docs.js new file mode 100644 index 0000000..739a064 --- /dev/null +++ b/Parsers/Docs.js @@ -0,0 +1,20 @@ +// Parser Name: Docs +// Listens for: !docs +// What it does: Returns a link to ServiceNow documentation using the current URL format + +var text = current.text + ''; +var docsMatch = text.match(/!docs\s+(.*)/i); + +if (docsMatch) { + var searchTerm = docsMatch[1].trim(); + var encodedTerm = encodeURIComponent(searchTerm); + var docsUrl = 'https://www.servicenow.com/docs/csh?version=latest&topicname=' + encodedTerm; + var searchUrl = 'https://www.servicenow.com/docs/?q=' + encodedTerm; + + new x_snc_slackerbot.Slacker().send_chat(current, + '*ServiceNow Docs: ' + searchTerm + '*\n' + + ':book: Search results: ' + searchUrl + '\n' + + ':link: Direct topic link: ' + docsUrl + ); +} + From c5e7ec569b36a040d3ab5acb9f5fb76009c50470 Mon Sep 17 00:00:00 2001 From: Ayushmann Ghodture <142772501+Ayushmann13479@users.noreply.github.com> Date: Sun, 21 Jun 2026 21:46:01 +0530 Subject: [PATCH 2/3] Switch to Frankfurter API and format converted amount Updated the API endpoint to use the Frankfurter API and modified the conversion amount to be formatted to two decimal places. --- Parsers/Currency Converter.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Parsers/Currency Converter.js b/Parsers/Currency Converter.js index 11194fa..2a26f5c 100644 --- a/Parsers/Currency Converter.js +++ b/Parsers/Currency Converter.js @@ -12,9 +12,9 @@ var amount = match ? match[1] : ""; var fromCurrency = match ? match[2] : ""; var toCurrency = match ? match[3] : ""; -// Build the search URL using the Currency Converter API -var baseUrl = 'https://api.exchangeratesapi.io/latest'; -var searchUrl = baseUrl + '?base=' + fromCurrency; +// Build the search URL using the Frankfurter API (free, no API key required) +var baseUrl = 'https://api.frankfurter.app/latest'; +var searchUrl = baseUrl + '?from=' + fromCurrency + '&to=' + toCurrency; // Make the API request var chatReq = new sn_ws.RESTMessageV2(); @@ -29,8 +29,8 @@ var responseData = JSON.parse(chatResponseBody); // Check if the API response contains exchange rates if (responseData.rates && responseData.rates[toCurrency]) { var exchangeRate = responseData.rates[toCurrency]; - var convertedAmount = amount * exchangeRate; - + var convertedAmount = (amount * exchangeRate).toFixed(2); + // Send a formatted message to Slack new x_snc_slackerbot.Slacker().send_chat(current, `${amount} ${fromCurrency} is equal to ${convertedAmount.toFixed(2)} ${toCurrency}`, false); } else { From 4e757899a192d61565e1b0910e87f7d0900dc3f2 Mon Sep 17 00:00:00 2001 From: Ayushmann Ghodture <142772501+Ayushmann13479@users.noreply.github.com> Date: Sun, 21 Jun 2026 22:08:23 +0530 Subject: [PATCH 3/3] Switch to Frankfurter API and format converted amount