From f57e13758c65cf821dbecc8a7bafa13f1061e2b6 Mon Sep 17 00:00:00 2001 From: Prakhar Goel Date: Mon, 14 Sep 2026 16:38:31 -0700 Subject: [PATCH] fix: replace dead exchangeratesapi endpoint and fix error message interpolation Co-authored-by: Cursor --- 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..6000b8e 100644 --- a/Parsers/Currency Converter.js +++ b/Parsers/Currency Converter.js @@ -9,12 +9,12 @@ var input = current.text.trim(); // Get entire user input after trimming // Extract amount, fromCurrency, and toCurrency from the input var match = input.match(/!convert (\d+) (\w+) to (\w+)/); var amount = match ? match[1] : ""; -var fromCurrency = match ? match[2] : ""; -var toCurrency = match ? match[3] : ""; +var fromCurrency = match ? match[2].toUpperCase() : ""; +var toCurrency = match ? match[3].toUpperCase() : ""; // Build the search URL using the Currency Converter API -var baseUrl = 'https://api.exchangeratesapi.io/latest'; -var searchUrl = baseUrl + '?base=' + fromCurrency; +var baseUrl = 'https://api.frankfurter.dev/v1/latest'; +var searchUrl = baseUrl + '?base=' + fromCurrency + '&symbols=' + toCurrency; // Make the API request var chatReq = new sn_ws.RESTMessageV2(); @@ -34,5 +34,5 @@ if (responseData.rates && responseData.rates[toCurrency]) { // 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 { - new x_snc_slackerbot.Slacker().send_chat(current, "Sorry, I couldn't find the exchange rate for ${fromCurrency} to ${toCurrency}.", false); + new x_snc_slackerbot.Slacker().send_chat(current, "Sorry, I couldn't find the exchange rate for " + fromCurrency + " to " + toCurrency + ".", false); }