Compare commits

...

129 commits
dev ... main

Author SHA1 Message Date
MoSiren 664e00b7f4 Update data/events.json
Some checks failed
ptero-push / build (push) Has been cancelled
updated some pri codes
2025-04-18 19:35:53 -06:00
MoSiren cce9b12645 Update data/events.json
Some checks are pending
ptero-push / build (push) Waiting to run
Flash Flood Warning Is Level 5
2025-04-18 19:30:46 -06:00
MoSiren c82ab68c1e Nexlabs Outlooks
Some checks failed
ptero-push / build (push) Has been cancelled
2025-03-13 23:51:03 -06:00
Christopher Cookman a543386394 Made the same mistake twice, dang
Some checks failed
ptero-push / build (push) Has been cancelled
2025-02-12 07:57:20 -07:00
Christopher Cookman 1ae72ac979 hotfix
Some checks are pending
ptero-push / build (push) Waiting to run
2025-02-12 07:56:27 -07:00
Christopher Cookman 1a7c1735f4 Fix log?
Some checks are pending
ptero-push / build (push) Waiting to run
2025-02-12 07:54:59 -07:00
Christopher Cookman 5b487125aa Update some logging stuff
Some checks are pending
ptero-push / build (push) Waiting to run
2025-02-12 07:51:27 -07:00
Christopher Cookman 770813b4a7 Whooooops
Some checks failed
ptero-push / build (push) Has been cancelled
2025-02-09 10:30:11 -07:00
Christopher Cookman ded7a2373c Attempt to not throw error when we cant DM a user!
Some checks are pending
ptero-push / build (push) Waiting to run
2025-02-09 10:29:05 -07:00
Christopher Cookman 79ae2f4c25 Fix sat typo, mb
Some checks are pending
ptero-push / build (push) Waiting to run
2025-02-09 10:23:15 -07:00
Christopher Cookman e02faaab18 Add bypass to deletion for main guild
Some checks failed
ptero-push / build (push) Has been cancelled
2025-02-03 05:04:21 -07:00
Christopher Cookman bd275403e9 Add discord message when unknown event type trips
Some checks failed
ptero-push / build (push) Has been cancelled
2025-01-13 14:36:08 -07:00
Christopher Cookman 9b80f79436 Add Pilot Reports to events 2025-01-13 14:35:07 -07:00
Christopher Cookman 4bb679cef8 Add perm check to subscribe command
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-13 14:24:01 -07:00
Christopher Cookman e952ec60e7 Notify guild owners and remove subs
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 23:36:26 -07:00
Christopher Cookman 0227979176 Add full sub info to permission errors
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 03:18:24 -07:00
Christopher Cookman 9f31d18a6f Smol fix
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 03:06:31 -07:00
Christopher Cookman d491fda5c8 Im dumb
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 03:04:56 -07:00
Christopher Cookman 96912d325a Make embed smaller
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 03:04:09 -07:00
Christopher Cookman 00f97fd6e6 Damn, busy night lol
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 03:02:13 -07:00
Christopher Cookman 09f3fc957c Fix issue
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 03:01:17 -07:00
Christopher Cookman cbb1842100 Add message to log channel about failed sends
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 03:00:31 -07:00
Christopher Cookman f763a95472 bwuuuuh
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 02:54:21 -07:00
Christopher Cookman d88188182c Bwuh
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 02:52:16 -07:00
Christopher Cookman 8b94e7e3f8 Possibly notify of bad perms?
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 02:50:54 -07:00
Christopher Cookman d653bc3e90 Add discord error logs
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 02:41:40 -07:00
Christopher Cookman b5bf06a38d Fix that
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 02:36:44 -07:00
Christopher Cookman ae63a0d52d Add .catch to sending discord messages. Hopefully this will fix the log flooding lol
Some checks are pending
ptero-push / build (push) Waiting to run
2025-01-12 02:31:17 -07:00
MoSiren 73e42e2288 Updated WSW.
Some checks failed
ptero-push / build (push) Has been cancelled
2024-11-21 17:26:34 -07:00
MoSiren 9afdd5626e Update data/events.json
Some checks failed
ptero-push / build (push) Has been cancelled
2024-09-27 13:48:25 -06:00
MoSiren f6acab4d20 Update data/events.json
Some checks are pending
ptero-push / build (push) Waiting to run
NPW 3
2024-09-27 12:41:01 -06:00
MoSiren b10308ef36 Update data/events.json
Some checks failed
ptero-push / build (push) Has been cancelled
Fixed Hurricane Warnings and Tropical Storm Warnings that Show at lowest level. Now set to High instead of Lowest
2024-09-26 07:57:25 -06:00
Christopher Cookman aa8fe9498f
Update
Some checks failed
ptero-push / build (push) Has been cancelled
- Use cached URL for nwrstreams
2024-08-16 03:11:16 -06:00
Christopher Cookman d48fe3085a
Update
Some checks are pending
ptero-push / build (push) Waiting to run
- Make NWRplay use new GWES icecast server!
2024-08-15 23:09:16 -06:00
Christopher Cookman 662e0e775c
Fix
Some checks are pending
ptero-push / build (push) Waiting to run
- Restart after 10 minutes of inactivity from weather.im
2024-08-15 22:35:44 -06:00
Christopher Cookman 845fead37a
Backend Update
Some checks are pending
ptero-push / build (push) Waiting to run
- Send a message to the user who added the bot to a guild with support link
2024-08-15 22:33:18 -06:00
Christopher Cookman 70c30420fc uh
All checks were successful
ptero-push / build (push) Successful in 11s
2024-07-31 21:08:43 -06:00
Christopher Cookman 98673be5c7
# Major Bug Fix
Some checks failed
ptero-push / build (push) Has been cancelled
- "You had it set to 'W' for Wumbo, when you should've had it set to 'M' for mini."

Fixed a small issue involving capitalization.
TL;DR Fixed evtFilter for guild channels :)
2024-07-16 21:51:11 -06:00
Christopher Cookman aac1420964
guess it cant be a dm thing
Some checks are pending
ptero-push / build (push) Waiting to run
2024-07-15 20:05:50 -06:00
Christopher Cookman 7a12ed05d3
G U H
Some checks are pending
ptero-push / build (push) Waiting to run
2024-07-15 20:03:01 -06:00
Christopher Cookman c223eabc62 Add PRIVACY.md
Some checks failed
ptero-push / build (push) Has been cancelled
Discorf
2024-07-05 16:01:56 -06:00
Christopher Cookman 6b9438ed10 Add TERMS.md
Some checks are pending
ptero-push / build (push) Waiting to run
For discorf
2024-07-05 15:59:44 -06:00
Christopher Cookman 928cb4b958
Use djs 14.14.1 (Weird issue with entitlements?)
Some checks failed
ptero-push / build (push) Has been cancelled
2024-07-02 17:50:47 -06:00
Christopher Cookman 42487f22b6
Guh
Some checks failed
ptero-push / build (push) Has been cancelled
2024-07-01 02:05:12 -06:00
Christopher Cookman 7b96229d01
Nvm
Some checks are pending
ptero-push / build (push) Waiting to run
2024-06-29 22:50:40 -06:00
Christopher Cookman df411d192d
Temporary fix to a much bigger future problem
Some checks are pending
ptero-push / build (push) Waiting to run
2024-06-29 22:47:03 -06:00
Christopher Cookman b76a77807b
Possible fix to #20
All checks were successful
ptero-push / build (push) Successful in 5s
2024-06-22 20:59:27 -06:00
Christopher Cookman 5168c5c582
Update UA
All checks were successful
ptero-push / build (push) Successful in 4s
2024-06-20 18:11:15 -06:00
Christopher Cookman 2ff7a2522a
Change | for ·
All checks were successful
ptero-push / build (push) Successful in 4s
2024-06-20 17:56:38 -06:00
Christopher Cookman d8b6d04edf
Doing stuff to /forecast 2024-06-20 17:55:56 -06:00
Christopher Cookman 70cce9e2ba Update funcs.js
All checks were successful
ptero-push / build (push) Successful in 4s
2024-06-20 12:45:54 -06:00
Christopher Cookman 1001d80313 Update funcs.js
All checks were successful
ptero-push / build (push) Successful in 4s
2024-06-20 11:11:44 -06:00
Christopher Cookman fbcc902bba Update funcs.js
All checks were successful
ptero-push / build (push) Successful in 6s
2024-06-20 11:10:26 -06:00
Christopher Cookman 6bdc4240be show full error on /forecast
All checks were successful
ptero-push / build (push) Successful in 5s
2024-06-20 11:07:14 -06:00
MoSiren be0d17cf6d Added "REP" RECCO Observations (tropical cyclone) NHC Product
All checks were successful
ptero-push / build (push) Successful in 4s
2024-06-20 03:56:39 +00:00
Christopher Cookman cea680a013
Add /forecast
All checks were successful
ptero-push / build (push) Successful in 4s
2024-06-19 21:37:18 -06:00
MoSiren ff0f4da7ad Updated Description on Setupall
All checks were successful
ptero-push / build (push) Successful in 4s
2024-06-19 03:04:58 +00:00
Christopher Cookman 539eccf7e2 Add about and support to self-added commands
All checks were successful
ptero-push / build (push) Successful in 4s
2024-06-18 21:03:31 -06:00
MoSiren 417777edb9 removed KGRX from NWRPLAY
All checks were successful
ptero-push / build (push) Successful in 4s
2024-06-19 02:57:37 +00:00
Christopher Cookman b382b95f6e
Test 2
All checks were successful
ptero-push / build (push) Successful in 4s
2024-06-18 20:54:29 -06:00
Christopher Cookman ea8c2be4a1
First try at runners on forgejo
Some checks are pending
ptero-push / build (push) Waiting to run
2024-06-18 20:53:22 -06:00
MoSiren 177f2c8dc3 added "AHO" NHC Product 2024-06-19 02:35:49 +00:00
Christopher Cookman c77577a382
Fix outlook command 2024-06-18 20:31:48 -06:00
Christopher Cookman 46000e92ee
Add ability to install app to user.
Will add more commands as needed
2024-06-18 20:26:45 -06:00
Christopher Cookman 04d3cb80e0
- Fix about command pfp
- Update sub/unsub command perms
2024-06-18 15:33:18 -06:00
Christopher Cookman dcf5518288 Merge pull request 'The "url" on line 1221 is a discord thing, you cannot change it to anything else' (#17) from Testing into main
Reviewed-on: ChrisChrome/weather-bot#17
2024-06-18 13:22:14 -06:00
Christopher Cookman 3e322de6cd
Just gonna make this change directly on main 2024-06-18 13:20:48 -06:00
Christopher Cookman 476f2fd946 Merge branch 'main' into Testing 2024-06-18 13:19:39 -06:00
Christopher Cookman ca785ea546
The "url" on line 1221 is a discord thing, you cannot change it to anything else 2024-06-18 13:19:04 -06:00
MoSiren 199cd70da5 nwrstream URL update 2024-06-18 08:40:02 +00:00
MoSiren 4b8d0515f9 Merge pull request 'Add NWRplay command' (#16) from Testing into main
Reviewed-on: ChrisChrome/weather-bot#16
2024-06-18 00:53:53 -06:00
MoSiren 64f4bc676e Fix URL 2024-06-18 06:47:07 +00:00
MoSiren a8aebe683c Error With Chris PFP not showing up when not in the discord server. 2024-06-18 06:45:51 +00:00
Christopher Cookman 249788ae8c Merge branch 'main' into Testing 2024-06-18 00:13:46 -06:00
Christopher Cookman 0f495feb55
Fix anthony's code :P 2024-06-18 00:09:40 -06:00
MoSiren ec176a87c2 Somewhat of a fix still issues where some commands dont show in certian servers. 2024-06-12 21:28:36 +00:00
Christopher Cookman 081b4ef261
Autocomplete nwrplay 2024-06-11 22:01:15 -06:00
MoSiren e5d9a687d4 NWR Play Works 2024-06-12 03:11:58 +00:00
MoSiren 0a9376d4d7 Trial For NWR Streams with own command. 2024-06-12 02:29:12 +00:00
MoSiren 2e92abfb21 Scary 2.0 2024-06-12 00:07:02 +00:00
MoSiren e9b206afff scary 2024-06-12 00:03:58 +00:00
MoSiren cb5ac958a3 Updated Readme for a slight issue with Sodium on Windows. Also Changed a Note in Index.js 2024-06-11 23:12:22 +00:00
Christopher Cookman 5e6a4388bb
Fix sat ext 2024-06-11 14:07:56 -06:00
Christopher Cookman 595fc8c7c6
Fix Fulldisk (Thanks discord data cap) 2024-06-11 14:05:01 -06:00
Christopher Cookman ad8196be72
Add FullDisk to sats 2024-06-11 14:01:54 -06:00
MoSiren f06d87b71d Updated Sattelites.json and added GOES18 2024-06-11 19:56:57 +00:00
MoSiren e59ccaf3ff Updated Bcfy voice commands to be there own. 2024-06-11 19:39:46 +00:00
MoSiren 7b49ad0d38 Added Event GMT 2024-06-11 01:56:47 -06:00
MoSiren 9014f05e83 added more airport codes to blacklist. 2024-06-10 17:42:23 -06:00
Christopher Cookman 1fc05649af
Remove blacklist on botstalk 2024-06-10 01:33:19 -06:00
MoSiren 6100e1dee0 Updated error on File 2024-06-05 17:50:59 -06:00
MoSiren 17fd8f45fe Added Airports codes
These just post MCDs and WCNs that's all. and they hog the server and make it status 429 Too Many Requests.
Possible slight fix in usage that's all.
2024-06-05 17:48:45 -06:00
Christopher Cookman 2752d67e22
Despite not wanting too, disabling botstalk 2024-05-27 22:26:51 -06:00
MoSiren 95f9a9fb31 Updated a few Event Codes 2024-05-26 14:21:43 -06:00
Christopher Cookman 6785d4d50a
Make voice commands only work in servers 2024-05-22 18:54:30 -06:00
Christopher Cookman ac2a1fb7b0
This is why we test shit before committing 2024-05-22 17:33:29 -06:00
Christopher Cookman a31573b7c4
Add automatic retry to fetching product text for filtering 2024-05-22 13:48:14 -06:00
Christopher Cookman 9393bf8f94
Fetch all alert users at startup 2024-05-22 12:51:49 -06:00
Christopher Cookman 54eb401093
Force all filters to be lowercase, for easier filtering 2024-05-22 12:34:09 -06:00
Christopher Cookman 6dd606209d
Make setupall put wfo in channel name 2024-05-22 10:44:19 -06:00
Christopher Cookman 4bfa1b4947 Merge pull request 'feat-unified-subscribe-command' (#12) from feat-unified-subscribe-command into main
Reviewed-on: ChrisChrome/weather-bot#12
2024-05-21 21:57:08 -06:00
Christopher Cookman 6887192f8e
Discord has a 100 char limit on command descriptions 💀 2024-05-21 20:27:45 -06:00
Christopher Cookman 3e792352d8
Update descriptions in commands.json 2024-05-21 20:23:24 -06:00
Christopher Cookman 5075a5973d
Merge subscribe and usersubscribe into just /subscribe 2024-05-21 20:21:08 -06:00
Christopher Cookman d64e402e16
WHOOPS 2024-05-21 19:29:18 -06:00
Christopher Cookman 323cf185e5
Doing stuff for ntfy for once 2024-05-21 19:28:58 -06:00
Christopher Cookman e30af0143d
Maybe a fix to ntfy being silly 2024-05-21 19:24:38 -06:00
Christopher Cookman 585c075072
Fix filter on usersub 2024-05-21 17:10:05 -06:00
Christopher Cookman cca3f180fb
Fix usersub filters. 2024-05-20 20:07:10 -06:00
Christopher Cookman 5e1635b9c1
Async 2024-05-20 12:28:31 -06:00
Christopher Cookman 498da05d55
Add sattelite imagery command 2024-05-20 12:27:38 -06:00
Christopher Cookman 4d8f9c072a
Close #8 2024-05-20 11:59:02 -06:00
Christopher Cookman 34f1580ff7
Fix that 2024-05-19 23:58:17 -06:00
Christopher Cookman e8b7da3d58
Add error.gif for future use funnies 2024-05-19 23:55:49 -06:00
Christopher Cookman a261733f21
Yeah no, no overlays on alert map 2024-05-19 23:54:36 -06:00
Christopher Cookman 821d6b52aa
No overlay for alert map, sadge 2024-05-19 23:50:15 -06:00
Christopher Cookman e60352d5c8
Add overlays to outlook command 2024-05-19 23:43:09 -06:00
Christopher Cookman 86d5105579
Im dumb, thats not right 2024-05-19 18:38:04 -06:00
Christopher Cookman 6679ea55c6 Attempt at adding timestamps 💀 2024-05-19 18:32:11 -06:00
MoSiren 66a454d46e Updating Priority for SVA / TOA 2024-05-19 17:38:11 -06:00
Christopher Cookman 2138bac3bb Merge pull request 'Merge feat-slash-outlook' (#10) from feat-slash-outlook into main
Reviewed-on: ChrisChrome/weather-bot#10
2024-05-19 10:29:52 -06:00
Christopher Cookman 99667e4890
Fix day being -1 2024-05-19 10:27:44 -06:00
Christopher Cookman 6332006702
Guh 2024-05-19 10:26:51 -06:00
Christopher Cookman b49d1c9a58
Make output of outlook not ephemeral 2024-05-19 10:26:14 -06:00
Christopher Cookman b86eabcf1b
Buh 2024-05-19 10:25:39 -06:00
Christopher Cookman 14faf62e90
I don't like Discord attachments. 2024-05-19 10:24:48 -06:00
Christopher Cookman fdd435c44a
Whoops 2024-05-19 10:12:57 -06:00
Christopher Cookman 4ca2435359
Impliment /outlook 2024-05-19 10:06:21 -06:00
MoSiren b9ebbccb90 Updated Priority for PTS and RET
PTS is the SPC outlooks that are issued if severe weather is expected. 
RET is EAS Activation Requested it seems to not be sent to IEMBot. More than likely used on NWWS-IO

PTS was updated from 1 to 3
RET was updated from 1 to 5.

MoSiren
2024-05-19 04:28:32 -06:00
25 changed files with 1516 additions and 421 deletions

View file

@ -0,0 +1,15 @@
# 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"}'

1
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1 @@
{}

7
PRIVACY.md Normal file
View file

@ -0,0 +1,7 @@
# 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,6 +3,8 @@
## 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.

5
TERMS.md Normal file
View file

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

View file

@ -70,5 +70,25 @@
"cwest@conference.weather.im",
"sweaseops1@conference.weather.im",
"scwx@conference.weather.im",
"nwsc@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"
]

256
data/commands.json Normal file
View file

@ -0,0 +1,256 @@
[
{
"name": "subscribe",
"description": "Subscribe to a weather.im room",
"default_member_permissions": 16,
"options": [
{
"name": "room",
"description": "The room/WFO you want to subscribe to",
"type": 3,
"required": true,
"autocomplete": false
},
{
"name": "message",
"description": "Custom message to send when alert is sent",
"type": 3,
"required": false
},
{
"name": "filter",
"description": "Filter for the alert, you can comma separate multiple strings of text",
"type": 3,
"required": false
},
{
"name": "minpriority",
"description": "Minimum priority to alert for",
"type": 4,
"required": false,
"choices": [
{
"name": "Any",
"value": 0
},
{
"name": "Minimum",
"value": 1
},
{
"name": "Low",
"value": 2
},
{
"name": "Normal",
"value": 3
},
{
"name": "High",
"value": 4
},
{
"name": "Very High",
"value": 5
}
]
},
{
"name": "filterevt",
"description": "Filter for event type, you can comma separate multiple strings of text",
"type": 3,
"required": false
}
]
},
{
"name": "unsubscribe",
"description": "Unsubscribe from a weather.im room",
"default_member_permissions": 16,
"options": [
{
"name": "room",
"description": "The room/WFO you want to unsubscribe from",
"type": 3,
"required": true,
"autocomplete": false
}
]
},
{
"name": "list",
"description": "List all subscribed rooms for this channel",
"default_member_permissions": 16
},
{
"name": "about",
"description": "About this bot",
"integration_types": [0,1],
"contexts": [0, 1, 2]
},
{
"name": "rooms",
"description": "List all available rooms"
},
{
"name": "setupall",
"description": "[BOT 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]
},
{
"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",
"description": "Day of outlook",
"type": 4,
"required": true,
"choices": [
{
"name": "Day 1",
"value": 0
},
{
"name": "Day 2",
"value": 1
},
{
"name": "Day 3",
"value": 2
},
{
"name": "Day 4",
"value": 3
},
{
"name": "Day 5",
"value": 4
},
{
"name": "Day 6",
"value": 5
},
{
"name": "Day 7",
"value": 6
},
{
"name": "Day 8",
"value": 7
}
]
},
{
"name": "type",
"description": "Type of outlook",
"type": 3,
"required": true,
"choices": [
{
"name": "Fire",
"value": "fire"
},
{
"name": "Convective",
"value": "convective"
}
]
},
{
"name": "population_overlay",
"description": "Whether to add the population overlay",
"type": 5,
"required": false
},
{
"name": "city_overlay",
"description": "Whether to add the city name overlay",
"type": 5,
"required": false
},
{
"name": "cwa_overlay",
"description": "Whether to add the County Warning Area overlay",
"type": 5,
"required": false
},
{
"name": "rfc_overlay",
"description": "Whether to add the River Forecast Center overlay",
"type": 5,
"required": false
},
{
"name": "interstate_overlay",
"description": "Whether to add the interstate overlay",
"type": 5,
"required": false
},
{
"name": "county_overlay",
"description": "Whether to add the county lines overlay",
"type": 5,
"required": false
},
{
"name": "tribal_overlay",
"description": "Whether to add the tribal lands overlay",
"type": 5,
"required": false
},
{
"name": "artcc_overlay",
"description": "Whether to add the Air Route Traffic Control Centers overlay",
"type": 5,
"required": false
},
{
"name": "fema_overlay",
"description": "Whether to add the FEMA regions overlay",
"type": 5,
"required": false
}
]
},
{
"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
}
]
}
]

View file

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

11
data/nwrstreams.json Normal file
View file

@ -0,0 +1,11 @@
{
"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"
}
}

22
data/outlook.json Normal file
View file

@ -0,0 +1,22 @@
{
"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"
],
"fire": [
"https://www.spc.noaa.gov/products/exper/fire_wx/imgs/day1otlk_fire.gif",
"https://www.spc.noaa.gov/products/exper/fire_wx/imgs/day2otlk_fire.gif",
"https://www.spc.noaa.gov/products/exper/fire_wx/imgs/day3otlk_fire.gif",
"https://www.spc.noaa.gov/products/exper/fire_wx/imgs/day4otlk_fire.gif",
"https://www.spc.noaa.gov/products/exper/fire_wx/imgs/day5otlk_fire.gif",
"https://www.spc.noaa.gov/products/exper/fire_wx/imgs/day6otlk_fire.gif",
"https://www.spc.noaa.gov/products/exper/fire_wx/imgs/day7otlk_fire.gif",
"https://www.spc.noaa.gov/products/exper/fire_wx/imgs/day8otlk_fire.gif"
]
}

187
data/satellites.json Normal file
View file

@ -0,0 +1,187 @@
{
"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"
}
}
}
}

138
funcs.js Normal file
View file

@ -0,0 +1,138 @@
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
};

BIN
images/error.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
images/overlays/artcc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
images/overlays/city.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
images/overlays/county.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
images/overlays/cwa.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
images/overlays/fema.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
images/overlays/rfc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
images/overlays/tribal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

1203
index.js

File diff suppressed because it is too large Load diff

View file

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