From 92861365b2275501aebeafcc13c6e6af54f397f0 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Sun, 25 May 2025 17:47:44 -0600 Subject: [PATCH] Guh --- data/events.json | 6 ++++-- index.js | 10 +++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/data/events.json b/data/events.json index 5b4fc35..e6360d0 100644 --- a/data/events.json +++ b/data/events.json @@ -1121,7 +1121,8 @@ }, "TAF": { "priority": 1, - "text": "Terminal Aerodrome Forecast" + "text": "Terminal Aerodrome Forecast", + "disable": true }, "TAP": { "priority": 1, @@ -1525,6 +1526,7 @@ }, "PIR": { "text": "Pilot Reports", - "priority": 1 + "priority": 1, + "disable": true } } diff --git a/index.js b/index.js index c306734..26bf4ea 100644 --- a/index.js +++ b/index.js @@ -365,6 +365,7 @@ const handleDiscord = function (data) { var evt = events[product_id.pil.substring(0, 3)]; evt.code = product_id.pil.substring(0, 3); console.log(`${colors.cyan("[INFO]")} ${fromChannel} @ ${product_id.timestamp}; ${evt.code} (${evt.priority}) ${body.string}`); + if (evt.disable) return console.log(`${colors.yellow("[WARN]")} Event ${evt.code} is disabled, skipping...`); let embed = { description: ` ${body.string}`, color: parseInt(config.priorityColors[evt.priority].replace("#", ""), 16) || 0x000000, @@ -537,7 +538,14 @@ var retries = 0; function connectWebSocket() { console.log('Attempting to connect to WebSocket...'); - const ws = new WebSocket(config.WS_URL || "wss://iem-alerter.ko4wal.radio/iem"); + const ws = new WebSocket( + config.WS_URL || "wss://iem-alerter.ko4wal.radio/iem", + { + headers: { + "user-agent": "IEM-Alerter-DiscordBot/1.0 (+https://git.chrischro.me/iem-alerter/discord-bot; contact: me@ko4wal.radio)" + } + } + ); ws.on('open', () => { console.log('Connected to WebSocket');