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] 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 + ); +} +