2024-10-28 00:59:04 +00:00
|
|
|
use skynet_discord_bot::common::database::db_init;
|
2024-10-28 01:06:21 +00:00
|
|
|
use skynet_discord_bot::common::minecraft::{get_minecraft_config, update_server, whitelist_wipe};
|
2024-10-28 21:53:04 +00:00
|
|
|
use skynet_discord_bot::get_config;
|
|
|
|
use std::collections::HashSet;
|
2024-03-05 19:55:38 +00:00
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() {
|
|
|
|
let config = get_config();
|
|
|
|
let db = match db_init(&config).await {
|
|
|
|
Ok(x) => x,
|
|
|
|
Err(_) => return,
|
|
|
|
};
|
|
|
|
|
2024-06-03 02:04:26 +01:00
|
|
|
let servers = get_minecraft_config(&db).await;
|
|
|
|
let mut wiped = HashSet::new();
|
2024-05-06 02:09:02 +01:00
|
|
|
|
2024-06-03 02:04:26 +01:00
|
|
|
for server in &servers {
|
|
|
|
// wipe whitelist first
|
|
|
|
if !wiped.contains(&server.minecraft) {
|
2024-09-17 00:21:07 +01:00
|
|
|
whitelist_wipe(&server.minecraft, &config.discord_token_minecraft).await;
|
2024-06-03 02:04:26 +01:00
|
|
|
// add it to teh done list so its not done again
|
|
|
|
wiped.insert(&server.minecraft);
|
2024-05-06 02:09:02 +01:00
|
|
|
}
|
|
|
|
|
2024-06-03 02:04:26 +01:00
|
|
|
update_server(&server.minecraft, &db, &server.discord, &config).await;
|
2024-03-05 19:55:38 +00:00
|
|
|
}
|
|
|
|
}
|