Redo WFOs, auto generate them

This commit is contained in:
Christopher Cookman 2024-05-16 21:01:16 -06:00
parent 88827c513e
commit 403ee86e4d
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42
4 changed files with 1366 additions and 490 deletions

View file

@ -1,47 +1,73 @@
[ [
"rerchat@conference.weather.im",
"ncrfcchat@conference.weather.im",
"mkx_madison_spotters@conference.weather.im", "mkx_madison_spotters@conference.weather.im",
"zanchat@conference.weather.im",
"michiganwxalerts@conference.weather.im", "michiganwxalerts@conference.weather.im",
"skywarnstatewidechase@conference.weather.im", "skywarnstatewidechase@conference.weather.im",
"wws44fl@conference.weather.im", "wws44fl@conference.weather.im",
"hatchat@conference.weather.im",
"crisfield-chat@conference.weather.im", "crisfield-chat@conference.weather.im",
"gstweather@conference.weather.im", "gstweather@conference.weather.im",
"tws_chat@conference.weather.im",
"franklin_chat@conference.weather.im", "franklin_chat@conference.weather.im",
"cnrfcchat@conference.weather.im",
"mke-skywarn@conference.weather.im", "mke-skywarn@conference.weather.im",
"tnwxdiscuss@conference.weather.im", "tnwxdiscuss@conference.weather.im",
"khws@conference.weather.im", "khws@conference.weather.im",
"kcichat@conference.weather.im",
"kodster@conference.weather.im", "kodster@conference.weather.im",
"wxst@conference.weather.im", "wxst@conference.weather.im",
"reddit_weatherlab@conference.weather.im", "reddit_weatherlab@conference.weather.im",
"nalsw@conference.weather.im", "nalsw@conference.weather.im",
"barnburnerwi@conference.weather.im", "barnburnerwi@conference.weather.im",
"ohiostormspottersteamoss@conference.weather.im", "ohiostormspottersteamoss@conference.weather.im",
"siawx_chat@conference.weather.im",
"n90@conference.weather.im", "n90@conference.weather.im",
"nerfcchat@conference.weather.im", "nerfcchat@conference.weather.im",
"lmrfcchat@conference.weather.im",
"mbrfcchat@conference.weather.im",
"pitchat@conference.weather.im", "pitchat@conference.weather.im",
"chachat@conference.weather.im", "chachat@conference.weather.im",
"spcmobile2006@conference.weather.im", "spcmobile2006@conference.weather.im",
"phl@conference.weather.im", "phl@conference.weather.im",
"wbkoweatherwatchers@conference.weather.im", "wbkoweatherwatchers@conference.weather.im",
"gcwxchat@conference.weather.im",
"zzmkxchat@conference.weather.im",
"dentcoeas@conference.weather.im",
"marfcchat@conference.weather.im",
"easwtalk@conference.weather.im", "easwtalk@conference.weather.im",
"gccc-nc-skywarn@conference.weather.im", "gccc-nc-skywarn@conference.weather.im",
"cyschat@conference.weather.im",
"mseas-weather-discussion@conference.weather.im", "mseas-weather-discussion@conference.weather.im",
"abc3340@conference.weather.im", "abc3340@conference.weather.im",
"awpwxchat@conference.weather.im",
"wilchat@conference.weather.im",
"okc_chatrooms@conference.weather.im", "okc_chatrooms@conference.weather.im",
"kdtxchat@conference.weather.im",
"wnpchat@conference.weather.im",
"fox6chat@conference.weather.im",
"cbrfcchat@conference.weather.im",
"wisconsin_storm_spotters@conference.weather.im", "wisconsin_storm_spotters@conference.weather.im",
"nwrfcchat@conference.weather.im",
"wgrfcchat@conference.weather.im",
"uswat@conference.weather.im", "uswat@conference.weather.im",
"iowawx@conference.weather.im",
"ohrfcchat@conference.weather.im",
"serfcchat@conference.weather.im",
"stichat@conference.weather.im",
"whntweather@conference.weather.im", "whntweather@conference.weather.im",
"knsw@conference.weather.im", "knsw@conference.weather.im",
"test@conference.weather.im", "test@conference.weather.im",
"abc3340skywatcher@conference.weather.im", "abc3340skywatcher@conference.weather.im",
"abrfcchat@conference.weather.im",
"bmxspotterchat@conference.weather.im", "bmxspotterchat@conference.weather.im",
"aprfcchat@conference.weather.im",
"wwsreport@conference.weather.im", "wwsreport@conference.weather.im",
"bmxalertchat@conference.weather.im", "bmxalertchat@conference.weather.im",
"twitter@conference.weather.im", "twitter@conference.weather.im",
"potomac_tracon@conference.weather.im", "potomac_tracon@conference.weather.im",
"detroiteaschat@conference.weather.im", "detroiteaschat@conference.weather.im",
"cwest@conference.weather.im", "cwest@conference.weather.im",
"wpcchat@conference.weather.im",
"sweaseops1@conference.weather.im", "sweaseops1@conference.weather.im",
"scwx@conference.weather.im", "scwx@conference.weather.im",
"nwsc@conference.weather.im" "nwsc@conference.weather.im"

File diff suppressed because it is too large Load diff

116
genblacklist.js Normal file
View file

@ -0,0 +1,116 @@
const goodrooms = require("./goodrooms.json");
// goodrooms is an array of objects {room: string, name: string}
const { client, xml } = require("@xmpp/client");
const colors = require("colors");
const generateRandomString = function (options, length) {
let result = '';
const characters = {
upper: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
lower: 'abcdefghijklmnopqrstuvwxyz',
number: '0123456789',
special: '!@#$%^&*()_+'
};
let chars = '';
for (const key in options) {
if (options[key]) {
chars += characters[key];
}
}
for (let i = 0; i < length; i++) {
result += chars.charAt(Math.floor(Math.random() * chars.length));
}
return result;
}
// Func to generate UUID
const generateUUID = function () {
return generateRandomString({ lower: true, upper: true, number: true }, 8) + "-" + generateRandomString({ lower: true, upper: true, number: true }, 4) + "-" + generateRandomString({ lower: true, upper: true, number: true }, 4) + "-" + generateRandomString({ lower: true, upper: true, number: true }, 4) + "-" + generateRandomString({ lower: true, upper: true, number: true }, 12);
}
const xmpp = client({
service: "xmpp://conference.weather.im",
domain: "weather.im",
resource: `discord-weather-bot-${generateRandomString({ upper: true, lower: true, number: true }, 5)}`, // Weird fix to "Username already in use"
});
var blacklist = [];
var rooms = {};
xmpp.on("stanza", (stanza) => {
// Debug stuff
// Handle Room List
if (stanza.is("iq") && stanza.attrs.type === "result" && stanza.getChild("query")) {
query = stanza.getChild("query");
if (query.attrs.xmlns === "http://jabber.org/protocol/disco#items") {
query.getChildren("item").forEach((item) => {
roomname = item.attrs.jid.split("@")[0];
console.log(`${colors.cyan("[INFO]")} Found room: ${item.attrs.jid}`);
// if room not in goodrooms list add to blacklist array
if (!goodrooms.find(room => room.room === roomname)) {
blacklist.push(item.attrs.jid);
return console.log(`${colors.red("[INFO]")} Added room to blacklist: ${roomname}`);
}
// Get proper text name from goodrooms
properName = goodrooms.find(room => room.room === roomname).name;
console.log(properName)
// room is in goodrooms, get first 3 of room name, add it to rooms object 3char: {room: roomname, name: name}
rooms[roomname.substring(0, 3)] = { room: roomname, location: properName };
});
clearTimeout(start);
start = setTimeout(() => {
console.log(`${colors.green("[INFO]")} Blacklist: ${JSON.stringify(blacklist)}`);
console.log(`${colors.green("[INFO]")} Rooms: ${JSON.stringify(rooms)}`);
xmpp.stop();
}, 5000);
}
}
});
xmpp.on("online", async (address) => {
errCount = 0;
// Start listening on all channels, (dont ban me funny man)
// for (const channel in iem) {
// console.log(`Joining ${channel.name}`)
// await xmpp.send(xml("presence", { to: `${channel.jud}/${channel.name}` }));
// }
/* sub format
<presence to="botstalk@conference.weather.im/add9b8f1-038d-47ed-b708-6ed60075a82f" xmlns="jabber:client">
<x xmlns="http://jabber.org/protocol/muc#user">
<item>
<role>visitor</role>
</item>
</x>
</presence>
*/
// Request room list
// Automatically find room list
xmpp.send(xml("iq", { type: "get", to: "conference.weather.im", id: "rooms" }, xml("query", { xmlns: "http://jabber.org/protocol/disco#items" })));
// Join all channels (Old method)
// iem.forEach((channel => {
// console.log(`${colors.cyan("[INFO]")} Joining ${channel.jid}/${channel.name}/${curUUID}`)
// //xmpp.send(xml("presence", { to: `${channel.jid}/${channel.jid.split("@")[0]}` }));
// xmpp.send(xml("presence", { to: `${channel.jid}/${channel.name}/${curUUID}` }, xml("item", { role: "visitor" })));
// }))
console.log(`${colors.cyan("[INFO]")} Connected to XMPP server as ${address.toString()}`);
setTimeout(() => {
startup = false;
console.log(`${colors.cyan("[INFO]")} Startup complete, listening for messages...`);
}, 1000)
});
var start = setTimeout(() => {
console.log(`${colors.green("[INFO]")} Blacklist: ${blacklist}`);
console.log(`${colors.green("[INFO]")} Rooms: ${rooms}`);
xmpp.stop();
}, 5000);
xmpp.start().catch(console.error);

654
goodrooms.json Normal file
View file

@ -0,0 +1,654 @@
[
{
"room": "botstalk",
"name": "All_Bots_Talk"
},
{
"room": "nhcchat",
"name": "National_Hurricane_Center"
},
{
"room": "spcchat",
"name": "Storm_Prediction_Center"
},
{
"room": "wpcchat",
"name": "Weather_Prediction_Center"
},
{
"room": "abqchat",
"name": "Albuquerque"
},
{
"room": "abrchat",
"name": "Aberdeen"
},
{
"room": "afcchat",
"name": "Anchorage"
},
{
"room": "afgchat",
"name": "Fairbanks"
},
{
"room": "ajkchat",
"name": "Juneau"
},
{
"room": "akqchat",
"name": "Wakefield"
},
{
"room": "alychat",
"name": "Albany"
},
{
"room": "amachat",
"name": "Amarillo"
},
{
"room": "apxchat",
"name": "Gaylord"
},
{
"room": "arxchat",
"name": "La_Crosse"
},
{
"room": "bgmchat",
"name": "Binghamton"
},
{
"room": "bischat",
"name": "Bismarck"
},
{
"room": "bmxchat",
"name": "Birmingham"
},
{
"room": "boichat",
"name": "Boise"
},
{
"room": "bouchat",
"name": "Denver"
},
{
"room": "boxchat",
"name": "Boston-Taunton"
},
{
"room": "brochat",
"name": "Brownsville"
},
{
"room": "btvchat",
"name": "Burlington"
},
{
"room": "bufchat",
"name": "Buffalo"
},
{
"room": "byzchat",
"name": "Billings"
},
{
"room": "caechat",
"name": "Columbia"
},
{
"room": "carchat",
"name": "Caribou"
},
{
"room": "chschat",
"name": "Charleston"
},
{
"room": "clechat",
"name": "Cleveland"
},
{
"room": "crpchat",
"name": "Corpus_Christi"
},
{
"room": "ctpchat",
"name": "State_College"
},
{
"room": "cyschat",
"name": "Cheyenne"
},
{
"room": "ddcchat",
"name": "Dodge_City"
},
{
"room": "dlhchat",
"name": "Duluth"
},
{
"room": "dmxchat",
"name": "Des_Moines"
},
{
"room": "dtxchat",
"name": "Detroit"
},
{
"room": "dvnchat",
"name": "Quad_Cities_Ia"
},
{
"room": "eaxchat",
"name": "Kansas_City-Pleasant_Hill"
},
{
"room": "ekachat",
"name": "Eureka"
},
{
"room": "epzchat",
"name": "El_Paso_Tx-Santa_Teresa"
},
{
"room": "ewxchat",
"name": "Austin-San_Antonio"
},
{
"room": "ffcchat",
"name": "Peachtree_City"
},
{
"room": "fgfchat",
"name": "Grand_Forks"
},
{
"room": "fgzchat",
"name": "Flagstaff"
},
{
"room": "fsdchat",
"name": "Sioux_Falls"
},
{
"room": "fwdchat",
"name": "Dallas-Fort_Worth"
},
{
"room": "ggwchat",
"name": "Glasgow"
},
{
"room": "gidchat",
"name": "Hastings"
},
{
"room": "gjtchat",
"name": "Grand_Junction"
},
{
"room": "gldchat",
"name": "Goodland"
},
{
"room": "grbchat",
"name": "Green_Bay"
},
{
"room": "grrchat",
"name": "Grand_Rapids"
},
{
"room": "gspchat",
"name": "Greenville-Spartanburg"
},
{
"room": "gumchat",
"name": "Guam"
},
{
"room": "gyxchat",
"name": "Gray"
},
{
"room": "hawaii",
"name": "Hawaii"
},
{
"room": "hfochat",
"name": "Honolulu"
},
{
"room": "hgxchat",
"name": "Houston-Galveston"
},
{
"room": "hnxchat",
"name": "San_Joaquin_Valley-Hanford"
},
{
"room": "hunchat",
"name": "Huntsville"
},
{
"room": "ictchat",
"name": "Wichita"
},
{
"room": "ilmchat",
"name": "Wilmington"
},
{
"room": "ilnchat",
"name": "Wilmington"
},
{
"room": "ilxchat",
"name": "Lincoln"
},
{
"room": "indchat",
"name": "Indianapolis"
},
{
"room": "iwxchat",
"name": "Northern_Indiana"
},
{
"room": "janchat",
"name": "Jackson"
},
{
"room": "jaxchat",
"name": "Jacksonville"
},
{
"room": "jklchat",
"name": "Jackson"
},
{
"room": "jsjchat",
"name": "San_Juan"
},
{
"room": "keychat",
"name": "Key_West"
},
{
"room": "lbfchat",
"name": "North_Platte"
},
{
"room": "lchchat",
"name": "Lake_Charles"
},
{
"room": "lixchat",
"name": "New_Orleans"
},
{
"room": "lknchat",
"name": "Elko"
},
{
"room": "lmkchat",
"name": "Louisville"
},
{
"room": "lotchat",
"name": "Chicago"
},
{
"room": "loxchat",
"name": "Los_Angeles-Oxnard"
},
{
"room": "lsxchat",
"name": "St_Louis"
},
{
"room": "lubchat",
"name": "Lubbock"
},
{
"room": "lwxchat",
"name": "Baltimore_Md-_Washington_Dc"
},
{
"room": "lzkchat",
"name": "Little_Rock"
},
{
"room": "mafchat",
"name": "Midland-Odessa"
},
{
"room": "megchat",
"name": "Memphis"
},
{
"room": "mflchat",
"name": "Miami"
},
{
"room": "mfrchat",
"name": "Medford"
},
{
"room": "mhxchat",
"name": "Newport-Morehead_City"
},
{
"room": "mkxchat",
"name": "Milwaukee-Sullivan"
},
{
"room": "mlbchat",
"name": "Melbourne"
},
{
"room": "mobchat",
"name": "Mobile"
},
{
"room": "mpxchat",
"name": "Twin_Cities-Chanhassen"
},
{
"room": "mqtchat",
"name": "Marquette"
},
{
"room": "mrxchat",
"name": "Morristown"
},
{
"room": "msochat",
"name": "Missoula"
},
{
"room": "mtrchat",
"name": "San_Francisco"
},
{
"room": "oaxchat",
"name": "Omaha-Valley"
},
{
"room": "ohxchat",
"name": "Nashville"
},
{
"room": "okxchat",
"name": "New_York"
},
{
"room": "otxchat",
"name": "Spokane"
},
{
"room": "ounchat",
"name": "Norman"
},
{
"room": "pahchat",
"name": "Paducah"
},
{
"room": "pbzchat",
"name": "Pittsburgh"
},
{
"room": "pdtchat",
"name": "Pendleton"
},
{
"room": "phichat",
"name": "Mount_Holly"
},
{
"room": "pihchat",
"name": "Pocatello-Idaho_Falls"
},
{
"room": "pqrchat",
"name": "Portland"
},
{
"room": "psrchat",
"name": "Phoenix"
},
{
"room": "pubchat",
"name": "Pueblo"
},
{
"room": "rahchat",
"name": "Raleigh"
},
{
"room": "revchat",
"name": "Reno"
},
{
"room": "riwchat",
"name": "Riverton"
},
{
"room": "rlxchat",
"name": "Charleston"
},
{
"room": "rnkchat",
"name": "Blacksburg"
},
{
"room": "sewchat",
"name": "Seattle"
},
{
"room": "sgfchat",
"name": "Springfield"
},
{
"room": "sgxchat",
"name": "San_Diego"
},
{
"room": "shvchat",
"name": "Shreveport"
},
{
"room": "sjtchat",
"name": "San_Angelo"
},
{
"room": "sjuchat",
"name": "San_Juan"
},
{
"room": "slcchat",
"name": "Salt_Lake_City"
},
{
"room": "stochat",
"name": "Sacramento"
},
{
"room": "taechat",
"name": "Tallahassee"
},
{
"room": "tbwchat",
"name": "Tampa_Bay_Area-Ruskin"
},
{
"room": "tfxchat",
"name": "Great_Falls"
},
{
"room": "topchat",
"name": "Topeka"
},
{
"room": "tsachat",
"name": "Tulsa"
},
{
"room": "twcchat",
"name": "Tucson"
},
{
"room": "unrchat",
"name": "Rapid_City"
},
{
"room": "vefchat",
"name": "Las_Vegas"
},
{
"room": "alrchat",
"name": "Atlanta_RFC"
},
{
"room": "fwrchat",
"name": "West_Gulf_RFC"
},
{
"room": "krfchat",
"name": "Missouri_River_Basin_RFC"
},
{
"room": "msrchat",
"name": "North_Central_RFC"
},
{
"room": "ornchat",
"name": "Lower_Mississippi_RFC"
},
{
"room": "pacrchat",
"name": "Alaska_-_Pacific_RFC"
},
{
"room": "ptrchat",
"name": "Northwest_RFC"
},
{
"room": "rhachat",
"name": "Mid_Atlantic_RFC"
},
{
"room": "rsachat",
"name": "California_-_Nevada_RFC"
},
{
"room": "strchat",
"name": "Colorado_RFC"
},
{
"room": "tarchat",
"name": "Northeast_RFC"
},
{
"room": "tirchat",
"name": "Ohio_RFC"
},
{
"room": "tuachat",
"name": "Arkansas_Red_River_RFC"
},
{
"room": "pancchat",
"name": "Anchorage"
},
{
"room": "zabchat",
"name": "Albuquerque"
},
{
"room": "zauchat",
"name": "Chicago"
},
{
"room": "zbwchat",
"name": "Boston"
},
{
"room": "zdcchat",
"name": "Washington_DC"
},
{
"room": "zdvchat",
"name": "Denver"
},
{
"room": "zfwchat",
"name": "Fort_Worth"
},
{
"room": "zhnchat",
"name": "Honolulu_CWSU"
},
{
"room": "zhuchat",
"name": "Houston"
},
{
"room": "zidchat",
"name": "Indianapolis"
},
{
"room": "zjxchat",
"name": "Jacksonville"
},
{
"room": "zkcchat",
"name": "Kansas_City"
},
{
"room": "zlachat",
"name": "Los_Angeles"
},
{
"room": "zlcchat",
"name": "Salt_Lake_City"
},
{
"room": "zmachat",
"name": "Miami"
},
{
"room": "zmechat",
"name": "Memphis"
},
{
"room": "zmpchat",
"name": "Minneapolis"
},
{
"room": "znychat",
"name": "New_York"
},
{
"room": "zoachat",
"name": "Oakland"
},
{
"room": "zobchat",
"name": "Cleveland"
},
{
"room": "zsechat",
"name": "Seattle"
},
{
"room": "ztlchat",
"name": "Atlanta"
}
]