Skip to content

Commit

Permalink
Downdetector parser (#284)
Browse files Browse the repository at this point in the history
* Create Downdetector.js

* Update Downdetector.js for the code

* Update Downdetector.js

Fix a variable name
Add a list of mapped services
  • Loading branch information
hrichiksite authored Oct 29, 2023
1 parent 7c4914a commit b485ba3
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions Parsers/Downdetector.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
activation_example:!downdetector service-name
regex:!downdetector
flags:gmi
*/
var service = current.text.replace(/!downdetector/gmi, "").trim().toLowerCase();
var mapped_services = {
"aws": {
"link": "https://downdetector.com/status/aws-amazon-web-services/"
},
"doordash": {
"link": "https://downdetector.com/status/doordash/"
},
"spectrum": {
"link": "https://downdetector.com/status/spectrum/"
},
"diablo": {
"link": "https://downdetector.com/status/diablo/"
},
"servicenow": {
"link": "https://downdetector.com/status/service-now/"
},
"youtube": {
"link": "https://downdetector.com/status/youtube/"
},
"at&t": {
"link": "https://downdetector.com/status/att/"
},
"verizon": {
"link": "https://downdetector.com/status/verizon/"
},
"tmobile": {
"link": "https://downdetector.com/status/t-mobile/"
},
"gcp": {
"link": "https://downdetector.com/status/google-cloud/"
},
"google": {
"link": "https://downdetector.com/status/google/"
},
"googledrive": {
"link": "https://downdetector.com/status/google-drive/"
},
"waze": {
"link": "https://downdetector.com/status/waze/"
},
"x": {
"link": "https://downdetector.com/status/twitter/"
},
"gmail": {
"link": "https://downdetector.com/status/gmail/"
},
"office365": {
"link": "https://downdetector.com/status/microsoft-365/"
},
"azure": {
"link": "https://downdetector.com/status/windows-azure/"
},
"teams": {
"link": "https://downdetector.com/status/teams/"
},
"reddit": {
"link": "https://downdetector.com/status/reddit/"
},
"discord": {
"link": "https://downdetector.com/status/discord/"
},
"downdetector": {
"link": "https://downdetector.com/status/downdetector/"
}
}

if (service == '') {
var send_confusion = new x_snc_slackerbot.Slacker().send_chat(current.channel, ':upside_down_face: No service name given! Try with services like "google", "aws", etc.', false, '', current.thread_ts);
} else if(mapped_services[service] != undefined){
new x_snc_slackerbot.Slacker().send_chat(current, ">> Check status for the service here: "+ mapped_services[service].link.toString(), current.thread_ts);
} else {
new x_snc_slackerbot.Slacker().send_chat(current, "https://downdetector.com/search/?q="+ service.toString(), current.thread_ts);
}

0 comments on commit b485ba3

Please sign in to comment.