Compare commits

..

No commits in common. "main" and "feat-unified-subscribe-command" have entirely different histories.

16 changed files with 228 additions and 1007 deletions

View file

@ -1,15 +0,0 @@
# Workflow that runs on `chris-runner`, tells a pterodactyl server at https://panel.chrischro.me/ to restart server 8f44f1fd-8d29-4553-96f1-05dacfca454f with token stored in PTERO_KEY
name: ptero-push
on:
push:
branches:
- main
jobs:
build:
runs-on: docker
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run script
run: |
curl -X POST -H "Authorization: Bearer ${{ secrets.PTERO_KEY }}" -H "Content-Type: application/json" https://panel.chrischro.me/api/client/servers/8f44f1fd-8d29-4553-96f1-05dacfca454f/power -d '{"signal":"restart"}'

View file

@ -1 +0,0 @@
{}

View file

@ -1,7 +0,0 @@
# Privacy Policy
Just to make this simple, heres a list of whats stored and how it's used
- Discord channel/user IDs of subscribed channels/DMs - Should be obvious, in case it's not, we need these to know where to send alerts.
- IEM rooms and filters - Should also be obvious, but again, we need to know which rooms you subscribed to
Other than that, occasional debug logging may be enabled to fix bugs, and any logs gathered from debugging will be erased immidiately.

View file

@ -3,8 +3,6 @@
## Warning
This is SUPER tossed together. Might bother cleaning it up later.
Also If you run this on Windows for Debugging, Sodium might have a few issues installing with MSVS for certain users.
## What is this?
This is meant to be a public Discord bot. It connects via XMPP to Weather.IM and allows server owners to subscribe a channel to any number of weather alerts.

View file

@ -1,5 +0,0 @@
# Terms of Service
## This is mostly here to comply with Discord verified bot stuff
Other than complying with the GPL-3.0 License when contributing/using the code of this project, this bot is NOT to be used as an emergency alerting system, and should NOT be trusted with life/property under any circumstances.
Chris Chrome and any other contributors are not to be held liable should this not work in an emergency, as you shouldn't be using it for emergency alerts.

View file

@ -1,6 +1,5 @@
{
"debug": 0,
"voice_enabled": true,
"priorityColors": {
"1": "#00AFFF",
"2": "#00FF00",
@ -27,7 +26,6 @@
"username": "YOUR_USERNAME",
"password": "YOUR_PASSWORD"
},
"uptime-kuma": {
"enabled": false,
"url": "",

View file

@ -70,25 +70,5 @@
"cwest@conference.weather.im",
"sweaseops1@conference.weather.im",
"scwx@conference.weather.im",
"nwsc@conference.weather.im",
"zabchat@conference.weather.im",
"ztlchat@conference.weather.im",
"zbwchat@conference.weather.im",
"zauchat@conference.weather.im",
"zobchat@conference.weather.im",
"zdvchat@conference.weather.im",
"zfwchat@conference.weather.im",
"zhuchat@conference.weather.im",
"zidchat@conference.weather.im",
"zjxchat@conference.weather.im",
"zkcchat@conference.weather.im",
"zlachat@conference.weather.im",
"zmechat@conference.weather.im",
"zmachat@conference.weather.im",
"zmpchat@conference.weather.im",
"zoachat@conference.weather.im",
"zlcchat@conference.weather.im",
"zsechat@conference.weather.im",
"zdcchat@conference.weather.im",
"znychat@conference.weather.im"
"nwsc@conference.weather.im"
]

View file

@ -2,7 +2,7 @@
{
"name": "subscribe",
"description": "Subscribe to a weather.im room",
"default_member_permissions": 16,
"default_member_permissions": 0,
"options": [
{
"name": "room",
@ -66,7 +66,7 @@
{
"name": "unsubscribe",
"description": "Unsubscribe from a weather.im room",
"default_member_permissions": 16,
"default_member_permissions": 0,
"options": [
{
"name": "room",
@ -81,13 +81,11 @@
{
"name": "list",
"description": "List all subscribed rooms for this channel",
"default_member_permissions": 16
"default_member_permissions": 0
},
{
"name": "about",
"description": "About this bot",
"integration_types": [0,1],
"contexts": [0, 1, 2]
"description": "About this bot"
},
{
"name": "rooms",
@ -95,23 +93,19 @@
},
{
"name": "setupall",
"description": "[BOT OWNER ONLY] Setup channels in a category for all rooms",
"description": "[OWNER ONLY] Setup channels in a category for all rooms",
"default_member_permissions": 0,
"type": 1
},
{
"name": "support",
"description": "Get support for the bot",
"type": 1,
"integration_types": [0,1],
"contexts": [0, 1, 2]
"type": 1
},
{
"name": "outlook",
"description": "Get day 1-8 storm or fire outlook from the SPC",
"type": 1,
"integration_types": [0,1],
"contexts": [0, 1, 2],
"options": [
{
"name": "day",
@ -228,29 +222,6 @@
{
"name": "alertmap",
"description": "Get a map of active alerts",
"type": 1,
"integration_types": [0,1],
"contexts": [0, 1, 2]
},
{
"name": "forecast",
"description": "Get a forecast for a location",
"type": 1,
"integration_types": [0,1],
"contexts": [0, 1, 2],
"options": [
{
"name": "location",
"description": "Location to get forecast for (In the United States)",
"type": 3,
"required": true
},
{
"name": "periods",
"description": "Number of periods to get forecast for",
"type": 4,
"required": false
}
]
"type": 1
}
]

View file

@ -217,7 +217,7 @@
},
"DSW": {
"text": "Dust Storm Warning",
"priority": 4
"priority": 5
},
"EFP": {
"priority": 1,
@ -228,7 +228,7 @@
"text": "Average 6 To 10 Day Weather Outlook (Local)"
},
"EQI": {
"priority": 3,
"priority": 1,
"text": "Tsunami Bulletin"
},
"EQR": {
@ -385,14 +385,14 @@
},
"FRW": {
"text": "Fire Warning",
"priority": 3
"priority": 4
},
"FSH": {
"priority": 1,
"text": "Natl Marine Fisheries Administrative Service Message"
},
"FTM": {
"priority": 3,
"priority": 2,
"text": "WSR-88D Radar Outage Notification / Free Text Message"
},
"FTP": {
@ -600,7 +600,7 @@
"text": "Low Temperatures"
},
"LSR": {
"priority": 3,
"priority": 2,
"text": "Local Storm Report"
},
"LTG": {
@ -680,7 +680,7 @@
"text": "Data Mgt Message"
},
"NPW": {
"priority": 3,
"priority": 1,
"text": "Non-Precipitation Warnings / Watches / Advisories"
},
"NSH": {
@ -772,7 +772,7 @@
"text": "Preliminary Forecasts"
},
"PSH": {
"priority": 2,
"priority": 1,
"text": "Post Storm Hurricane Report"
},
"PTS": {
@ -1108,7 +1108,7 @@
"priority": 3
},
"SWO": {
"priority": 4,
"priority": 3,
"text": "Severe Storm Outlook Narrative (AC)"
},
"SWS": {
@ -1160,11 +1160,11 @@
"text": "Tropical Cyclone Update"
},
"TCV": {
"priority": 4,
"priority": 1,
"text": "Tropical Cyclone Watch/Warning Break Points"
},
"TIB": {
"priority": 3,
"priority": 2,
"text": "Tsunami Bulletin"
},
"TID": {
@ -1188,7 +1188,7 @@
"text": "Temperature Precipitation Table (Natl and Intnl)"
},
"TSU": {
"priority": 5,
"priority": 1,
"text": "Tsunami Watch/Warning"
},
"TUV": {
@ -1224,7 +1224,7 @@
"text": "Ultraviolet Index"
},
"VAA": {
"priority": 3,
"priority": 1,
"text": "Volcanic Activity Advisory"
},
"VER": {
@ -1308,7 +1308,7 @@
"text": "Routine Space Environment Product Issued Weekly"
},
"WOU": {
"priority": 5,
"priority": 4,
"text": "Tornado/Severe Thunderstorm Watch"
},
"WS1": {
@ -1345,7 +1345,7 @@
},
"WSW": {
"text": "Winter Storm Warning",
"priority": 4
"priority": 5
},
"WWA": {
"priority": 1,
@ -1365,11 +1365,11 @@
},
"CFA": {
"text": "Coastal Flood Watch",
"priority": 3
"priority": 4
},
"FLA": {
"text": "Flood Watch",
"priority": 3
"priority": 2
},
"HWA": {
"text": "High Wind Watch",
@ -1389,7 +1389,7 @@
},
"SVA": {
"text": "Severe Thunderstorm Watch",
"priority": 5
"priority": 4
},
"TOA": {
"text": "Tornado Watch",
@ -1405,7 +1405,7 @@
},
"TSA": {
"text": "Tsunami Watch",
"priority": 5
"priority": 4
},
"TSW": {
"text": "Tsunami Warning",
@ -1497,11 +1497,11 @@
},
"WFA": {
"text": "Wild Fire Watch",
"priority": 3
"priority": 4
},
"WFW": {
"text": "Wild Fire Warning",
"priority": 3
"priority": 4
},
"NMN": {
"text": "Network Message Notification",
@ -1510,21 +1510,5 @@
"AHD": {
"text": "Area Hydrological Discussion",
"priority": 1
},
"GMT": {
"text": "AIRMET",
"priority": 1
},
"AHO": {
"text": "High Density Observations (USAF/NOAA)",
"priority": 3
},
"REP": {
"text": "RECCO Observations (tropical cyclone)",
"priority": 3
},
"PIR": {
"text": "Pilot Reports",
"priority": 1
}
}

View file

@ -1,11 +0,0 @@
{
"callsigns": {
"WXL46": "https://icecast.sirenarchive.xyz/NWR/WXL46",
"WXJ61": "https://icecast.sirenarchive.xyz/NWR/WXJ61",
"KZZ57": "https://wxradio.org/IL-Rockford-KZZ57",
"KXI41": "https://wxradio.org/IL-CrystalLake-KXI41",
"KHB34": "https://wxradio.org/FL-Miami-KHB34",
"WNG663": "https://wxradio.org/FL-Princeton-WNG663",
"KEC80": "https://wxradio.org/GA-Atlanta-KEC80"
}
}

View file

@ -1,13 +1,13 @@
{
"convective": [
"https://weather.cod.edu/cdata/text/images/spc/co/day1/categorical/spccoday1.categorical.latest.png",
"https://climate.cod.edu/data/text/images/spc/co/day2/categorical/spccoday2.categorical.latest.png",
"https://climate.cod.edu/data/text/images/spc/co/day3/categorical/spccoday3.categorical.latest.png",
"https://climate.cod.edu/data/text/images/spc/co/day4/severe/spccoday4.severe.latest.png",
"https://climate.cod.edu/data/text/images/spc/co/day5/severe/spccoday5.severe.latest.png",
"https://climate.cod.edu/data/text/images/spc/co/day6/severe/spccoday6.severe.latest.png",
"https://climate.cod.edu/data/text/images/spc/co/day7/severe/spccoday7.severe.latest.png",
"https://climate.cod.edu/data/text/images/spc/co/day8/severe/spccoday8.severe.latest.png"
"https://www.spc.noaa.gov/products/outlook/day1otlk.gif",
"https://www.spc.noaa.gov/products/outlook/day2otlk.gif",
"https://www.spc.noaa.gov/products/outlook/day3otlk.gif",
"https://www.spc.noaa.gov/products/exper/day4-8/day4prob.gif",
"https://www.spc.noaa.gov/products/exper/day4-8/day5prob.gif",
"https://www.spc.noaa.gov/products/exper/day4-8/day6prob.gif",
"https://www.spc.noaa.gov/products/exper/day4-8/day7prob.gif",
"https://www.spc.noaa.gov/products/exper/day4-8/day8prob.gif"
],
"fire": [
"https://www.spc.noaa.gov/products/exper/fire_wx/imgs/day1otlk_fire.gif",

View file

@ -1,187 +0,0 @@
{
"GOES-16": {
"products": {
"Full Disk": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/FD/GEOCOLOR/1808x1808.jpg",
"Airmass": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/FD/AirMass/1808x1808.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/FD/13/1808x1808.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/FD/10/1808x1808.jpg"
},
"Floater 1": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/MESO/M1/GEOCOLOR/1000x1000.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/MESO/M1/13/1000x1000.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/MESO/M1/10/1000x1000.jpg"
},
"Floater 2": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/MESO/M2/GEOCOLOR/1000x1000.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/MESO/M2/13/1000x1000.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/MESO/M2/10/1000x1000.jpg"
},
"United States": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/CONUS/GEOCOLOR/2500x1500.jpg",
"Airmass": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/CONUS/AirMass/2500x1500.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/CONUS/13/2500x1500.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/CONUS/10/2500x1500.jpg"
},
"Canada": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/can/GEOCOLOR/2250x1125.jpg",
"Airmass": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/can/AirMass/2250x1125.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/can/13/2250x1125.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/can/10/2250x1125.jpg"
},
"Mexico": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/mex/GEOCOLOR/1000x1000.jpg",
"Airmass": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/mex/AirMass/1000x1000.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/mex/13/1000x1000.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/mex/10/1000x1000.jpg"
},
"US East Coast": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/eus/GEOCOLOR/1000x1000.jpg",
"Airmass": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/eus/AirMass/1000x1000.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/eus/13/1000x1000.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/eus/10/1000x1000.jpg"
},
"Gulf of Mexico": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/gm/GEOCOLOR/1000x1000.jpg",
"Airmass": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/gm/AirMass/1000x1000.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/gm/13/1000x1000.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/gm/10/1000x1000.jpg"
},
"Puerto Rico": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/pr/GEOCOLOR/1200x1200.jpg",
"Airmass": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/pr/AirMass/1200x1200.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/pr/13/1200x1200.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/pr/10/1200x1200.jpg"
}
}
},
"GOES-18": {
"products": {
"Full Disk": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/FD/GEOCOLOR/1808x1808.jpg",
"Airmass": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/FD/AirMass/1808x1808.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/FD/13/1808x1808.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/FD/10/1808x1808.jpg"
},
"Floater 1": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/MESO/M1/GEOCOLOR/1000x1000.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/MESO/M1/13/1000x1000.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/MESO/M1/10/1000x1000.jpg"
},
"Floater 2": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/MESO/M2/GEOCOLOR/1000x1000.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/MESO/M2/13/1000x1000.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/MESO/M2/10/1000x1000.jpg"
},
"US West Coast": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/wus/GEOCOLOR/1000x1000.jpg",
"Airmass": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/wus/AirMass/1000x1000.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/wus/13/1000x1000.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/wus/10/1000x1000.jpg"
},
"Hawaii": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/SECTOR/hi/GEOCOLOR/1200x1200.jpg",
"Airmass": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/SECTOR/hi/AirMass/1200x1200.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/SECTOR/hi/13/1200x1200.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/SECTOR/hi/10/1200x1200.jpg"
},
"Alaska": {
"Visible": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/SECTOR/ak/GEOCOLOR/1000x1000.jpg",
"Airmass": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/SECTOR/ak/AirMass/1000x1000.jpg",
"Infrared": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/SECTOR/ak/13/1000x1000.jpg",
"Water Vapor": "https://cdn.star.nesdis.noaa.gov/GOES18/ABI/SECTOR/ak/10/1000x1000.jpg"
}
}
},
"Himawari": {
"products": {
"Full Disk": {
"Visible": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/full_disk_ahi_true_color.jpg",
"Airmass": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/full_disk_ahi_rgb_airmass.jpg",
"Infrared": "https://www.ssec.wisc.edu/data/geo/images/himawari09/latest-himawari09_11_fd.gif",
"Water Vapor": "https://www.ssec.wisc.edu/data/geo/images/himawari09/latest-himawari09_10_fd.gif"
},
"Floater 1": {
"Visible": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest/himawari-8/floater_02_geocolor.pngv",
"Airmass": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest/himawari-8/floater_02_rgb_airmass.png"
},
"American Samoa": {
"Visible": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/american_samoa_ahi_natural_color.png",
"Airmass": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/american_samoa_ahi_rgb_airmass.png"
},
"Australia": {
"Visible": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest/himawari-8/australia_true_color.jpg",
"Airmass": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/australia_ahi_rgb_airmass.png"
},
"New Zealand": {
"Visible": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/new_zealand_ahi_natural_color.png",
"Airmass": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/new_zealand_ahi_rgb_airmass.png"
},
"Guam": {
"Visible": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/guam_ahi_natural_color.png",
"Airmass": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/guam_ahi_rgb_airmass.png"
},
"Hawaii": {
"Visible": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/hawaii_ahi_natural_color.png"
},
"Japan": {
"Visible": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/japan_ahi_natural_color.png",
"Airmass": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/japan_ahi_rgb_airmass.png"
},
"Russia": {
"Visible": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest/himawari-8/eastern_russia_true_color.jpg"
},
"China": {
"Visible": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/eastern_china_ahi_natural_color.png",
"Airmass": "https://rammb.cira.colostate.edu/ramsdis/online/images/latest_hi_res/himawari-8/eastern_china_ahi_rgb_airmass.png"
}
}
},
"EWS-G2": {
"products": {
"Full Disk": {
"Visible": "https://www.ssec.wisc.edu/data/geo/images/ews-g1/latest_ews-g1_01_fd.gif",
"Water Vapor": "https://www.ssec.wisc.edu/data/geo/images/ews-g1/latest_ews-g1_03_fd.gif"
}
}
},
"FY-2G": {
"products": {
"Full Disk": {
"Visible": "https://www.ssec.wisc.edu/data/geo/images/fy2g/latest_fy2g_01_fd.gif",
"Infrared": "https://www.ssec.wisc.edu/data/geo/images/fy2g/latest_fy2g_02_fd.gif",
"Water Vapor": "https://www.ssec.wisc.edu/data/geo/images/fy2g/latest_fy2g_04_fd.gif"
}
}
},
"GK-2A": {
"products": {
"Full Disk": {
"Infrared": "https://kiwiweather.com/gk-2a/FD_sanchez.jpg"
}
}
},
"Meteosat 9": {
"products": {
"Full Disk": {
"Visible": "https://www.ssec.wisc.edu/data/geo/images/met-iodc/latest_met-iodc_01_fd.jpg",
"Infrared": "https://www.ssec.wisc.edu/data/geo/images/met-iodc/latest_met-iodc_04_fd.jpg",
"Water Vapor": "https://www.ssec.wisc.edu/data/geo/images/met-iodc/latest_met-iodc_06_fd.jpg"
}
}
},
"Meteosat 10": {
"products": {
"Full Disk": {
"Visible": "https://www.ssec.wisc.edu/data/geo/images/met-prime/latest_met-prime_01_fd.gif",
"Infrared": "https://www.ssec.wisc.edu/data/geo/images/met-prime/latest_met-prime_04_fd.gif",
"Water Vapor": "https://www.ssec.wisc.edu/data/geo/images/met-prime/latest_met-prime_06_fd.gif"
},
"Europe": {
"Visible": "https://www.ssec.wisc.edu/data/geo/images/met-prime/latest_met-prime_01_euro.gif",
"Infrared": "https://www.ssec.wisc.edu/data/geo/images/met-prime/latest_met-prime_04_euro.gif",
"Water Vapor": "https://www.ssec.wisc.edu/data/geo/images/met-prime/latest_met-prime_06_euro.gif"
}
}
}
}

12
data/sattelites.json Normal file
View file

@ -0,0 +1,12 @@
{
"GOES-16": [
{
"name": "GeoColor",
"url": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/CONUS/GEOCOLOR/latest.jpg"
},
{
"name": "Infrared",
"url": "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/CONUS/13/latest.jpg"
}
]
}

138
funcs.js
View file

@ -1,138 +0,0 @@
const geolib = require("geolib");
// Use OSM API to get coordinates https://nominatim.openstreetmap.org/search?q=search+query&format=json&limit=1
const getCoordinates = async (location) => {
return new Promise((resolve, reject) => {
// Make location url friendly
location = encodeURIComponent(location);
const url = `https://nominatim.openstreetmap.org/search?q=${location}&format=json&limit=1`;
// use custom useragent (discord-iem-bot, chris@chrischro.me)
const options = {
headers: {
'User-Agent': 'Discord-IEM-Bot/1.0 (chris@chrischro.me)',
},
};
// Make request
fetch(url, options)
.then(response => response.json())
.then(data => {
if (data.length > 0) {
resolve({
lat: data[0].lat,
lon: data[0].lon,
});
} else {
reject('Location not found');
}
})
.catch(err => {
reject(err);
});
})
};
const getForecast = async (lat, lon) => {
return new Promise((resolve, reject) => {
const url = `https://api.weather.gov/points/${lat},${lon}`;
// use same custom ua
const options = {
headers: {
'User-Agent': 'Discord-IEM-Bot/1.0 (chris@chrischro.me)',
},
};
// Make request
fetch(url, options)
.then(response => response.json())
.then(data => {
if (data.properties?.forecast) {
fetch(data.properties.forecast)
.then(response => response.json())
.then(data2 => {
data2.properties.relativeLocation = data.properties.relativeLocation;
resolve(data2);
})
.catch(err => {
reject(err);
});
} else {
reject('Forecast not found');
}
})
.catch(err => {
reject(err);
});
})
};
const getWeatherBySearch = async (search) => {
return new Promise((resolve, reject) => {
getCoordinates(search)
.then(coords => {
getForecast(coords.lat, coords.lon)
.then(data => {
resolve(data);
})
.catch(err => {
reject(err);
});
})
.catch(err => {
reject(err);
});
})
};
const generateDiscordEmbeds = (forecastData, numOfDays) => {
// Take the first 7 periods and make them into embeds
const embeds = [];
if (!numOfDays) numOfDays = 1;
for (let i = 0; i < numOfDays; i++) {
const period = forecastData.properties.periods[i];
if (period.icon?.startsWith("/")) {
period.icon = `https://api.weather.gov${period.icon}`
}
const embed = {
title: `${period.name} in ${forecastData.properties.relativeLocation.properties.city} ${forecastData.properties.relativeLocation.properties.state}`,
description: `Valid <t:${new Date(period.startTime)/1000}:f> - <t:${new Date(period.endTime)/1000}:f>\n${period.detailedForecast}`,
timestamp: new Date(period.startTime),
thumbnail: {
url: period.icon,
},
fields: [
{
name: 'Temperature',
value: `${period.temperature}°F`,
inline: true
},
{
name: 'Wind',
value: `${period.windDirection}@${period.windSpeed}`,
inline: true
},
{
name: 'Precipitation',
value: period.probabilityOfPrecipitation?.value ? period.probabilityOfPrecipitation?.value + '%' : '0%',
inline: true
},
{
name: 'Humidity',
value: period.relativeHumidity?.value ? period.relativeHumidity.value + '%' : "0%",
}
],
footer: {
text: `Data provided by the National Weather Service · Elevation ${forecastData.properties.elevation.value}m`
}
};
embeds.push(embed);
}
return embeds;
}
module.exports = {
getCoordinates,
getForecast,
getWeatherBySearch,
generateDiscordEmbeds
};

715
index.js

File diff suppressed because it is too large Load diff

View file

@ -14,8 +14,7 @@
"@xmpp/client": "^0.13.1",
"@xmpp/debug": "^0.13.0",
"colors": "^1.4.0",
"discord.js": "14.14.1",
"geolib": "^3.3.4",
"discord.js": "^14.15.2",
"html-entities": "^2.5.2",
"jimp": "^0.22.12",
"sodium": "^3.0.2",