Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // To be used with Scriptable for iOS
- // Learn more at https://scriptable.app
- // Checks if Discord is down by examining
- // their status page. This script works
- // well when when triggered from a Siri
- // Shortcut. You can configure a Siri
- // Shortcut from the script settings.
- let url = "https://status.mojang.com/check"
- let r = new Request(url)
- let body = await r.loadJSON()
- Safari.openInApp(url)
- // Use the global variable "config" to check
- // if the app is run from Siri before we
- // speak a text.
- if (config.runsWithSiri) {
- let table = new UITable()
- table.showSeparators = true
- let names = [
- "Minecraft Website",
- "Sessions",
- "Accounts",
- "Auth Servers",
- "Session Servers",
- "API",
- "Textures",
- "Mojang Website"
- ]
- let count = 0
- body.forEach(function (statusObj) {
- for (var key in statusObj) {
- if (statusObj.hasOwnProperty(key)) {
- let row = new UITableRow()
- let name = names[count]
- if (statusObj[key] == "green") {
- let nameCell = row.addText(name, key)
- nameCell.leftAligned()
- let statusCell = row.addText("ONLINE")
- statusCell.rightAligned()
- } else {
- let nameCell = row.addText(name, key)
- nameCell.leftAligned()
- let statusCell = row.addText("OFFLINE")
- statusCell.rightAligned()
- }
- table.addRow(row)
- }
- count++
- }
- });
- table.present()
- let status = null
- if (body[3]["authserver.mojang.com"] == "green" || body[4]["sessionserver.mojang.com"] == "green") {
- status = true
- } else {
- status = false
- }
- if (status) {
- Speech.speak("No")
- } else {
- Speech.speak("Yes")
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement