@@ -9,12 +9,12 @@ var input = current.text.trim(); // Get entire user input after trimming
99// Extract amount, fromCurrency, and toCurrency from the input
1010var match = input . match ( / ! c o n v e r t ( \d + ) ( \w + ) t o ( \w + ) / ) ;
1111var amount = match ? match [ 1 ] : "" ;
12- var fromCurrency = match ? match [ 2 ] : "" ;
13- var toCurrency = match ? match [ 3 ] : "" ;
12+ var fromCurrency = match ? match [ 2 ] . toUpperCase ( ) : "" ;
13+ var toCurrency = match ? match [ 3 ] . toUpperCase ( ) : "" ;
1414
1515// Build the search URL using the Currency Converter API
16- var baseUrl = 'https://api.exchangeratesapi.io /latest' ;
17- var searchUrl = baseUrl + '?base=' + fromCurrency ;
16+ var baseUrl = 'https://api.frankfurter.dev/v1 /latest' ;
17+ var searchUrl = baseUrl + '?base=' + fromCurrency + '&symbols=' + toCurrency ;
1818
1919// Make the API request
2020var chatReq = new sn_ws . RESTMessageV2 ( ) ;
@@ -34,5 +34,5 @@ if (responseData.rates && responseData.rates[toCurrency]) {
3434 // Send a formatted message to Slack
3535 new x_snc_slackerbot . Slacker ( ) . send_chat ( current , `${ amount } ${ fromCurrency } is equal to ${ convertedAmount . toFixed ( 2 ) } ${ toCurrency } ` , false ) ;
3636} else {
37- new x_snc_slackerbot . Slacker ( ) . send_chat ( current , "Sorry, I couldn't find the exchange rate for ${ fromCurrency} to ${ toCurrency} ." , false ) ;
37+ new x_snc_slackerbot . Slacker ( ) . send_chat ( current , "Sorry, I couldn't find the exchange rate for " + fromCurrency + " to " + toCurrency + " .", false ) ;
3838}
0 commit comments