parent
33a5d21627
commit
92861365b2
|
@ -1121,7 +1121,8 @@
|
||||||
},
|
},
|
||||||
"TAF": {
|
"TAF": {
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"text": "Terminal Aerodrome Forecast"
|
"text": "Terminal Aerodrome Forecast",
|
||||||
|
"disable": true
|
||||||
},
|
},
|
||||||
"TAP": {
|
"TAP": {
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
|
@ -1525,6 +1526,7 @@
|
||||||
},
|
},
|
||||||
"PIR": {
|
"PIR": {
|
||||||
"text": "Pilot Reports",
|
"text": "Pilot Reports",
|
||||||
"priority": 1
|
"priority": 1,
|
||||||
|
"disable": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
index.js
10
index.js
|
@ -365,6 +365,7 @@ const handleDiscord = function (data) {
|
||||||
var evt = events[product_id.pil.substring(0, 3)];
|
var evt = events[product_id.pil.substring(0, 3)];
|
||||||
evt.code = 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}`);
|
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 = {
|
let embed = {
|
||||||
description: `<t:${new Date(product_id.timestamp) / 1000}:T> <t:${new Date(product_id.timestamp) / 1000}:R> ${body.string}`,
|
description: `<t:${new Date(product_id.timestamp) / 1000}:T> <t:${new Date(product_id.timestamp) / 1000}:R> ${body.string}`,
|
||||||
color: parseInt(config.priorityColors[evt.priority].replace("#", ""), 16) || 0x000000,
|
color: parseInt(config.priorityColors[evt.priority].replace("#", ""), 16) || 0x000000,
|
||||||
|
@ -537,7 +538,14 @@ var retries = 0;
|
||||||
|
|
||||||
function connectWebSocket() {
|
function connectWebSocket() {
|
||||||
console.log('Attempting to connect to WebSocket...');
|
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', () => {
|
ws.on('open', () => {
|
||||||
console.log('Connected to WebSocket');
|
console.log('Connected to WebSocket');
|
||||||
|
|
Loading…
Reference in a new issue