We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
if you !weather rochester (https://wttr.in/rochester), it doesn't tell you which Rochester the weather is for. It might be worth regexing the location
!weather rochester
Location: Rochester, Monroe County, New York, United States of America [43.157285,-77.6152139]
/Location: ([^[]+)\s/ would probably grab the location minus the coordinates.
/Location: ([^[]+)\s/
The text was updated successfully, but these errors were encountered:
I think this would work:
/* activation_example:!weather london regex:!weather flags:gmi */ var wordCount = current.text.replace('!weather', '').trim().split(' '); if (wordCount[0] != '') { var rm = new sn_ws.RESTMessageV2(); rm.setHttpMethod('GET'); rm.setLogLevel('all'); rm.setEndpoint('https://wttr.in/' + wordCount[0] + '?format=4'); var response = rm.execute(); var weatherBody = response.getBody(); var locrm = new sn_ws.RESTMessageV2(); locrm.setHttpMethod('GET'); locrm.setLogLevel('all'); locrm.setEndpoint('https://wttr.in/' + wordCount[0]); var locResponse = locrm.execute(); var locBody = locResponse.getBody(); var matches = locBody.match(/Location: ([^[]+)\s/); if (matches[1]) weatherBody = weatherBody.replace(/[^:]+/, matches[1]); new x_snc_slackerbot.Slacker().send_chat(current, weatherBody); } else { new x_snc_slackerbot.Slacker().send_chat(current, 'Please Provide Location Ex: "!weather london"'); }
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
if you
!weather rochester
(https://wttr.in/rochester), it doesn't tell you which Rochester the weather is for. It might be worth regexing the locationLocation: Rochester, Monroe County, New York, United States of America [43.157285,-77.6152139]
/Location: ([^[]+)\s/
would probably grab the location minus the coordinates.The text was updated successfully, but these errors were encountered: