diff --git a/src/bin/update_data.rs b/src/bin/update_data.rs index 22bd5bd..ec3713a 100644 --- a/src/bin/update_data.rs +++ b/src/bin/update_data.rs @@ -4,7 +4,7 @@ use serenity::{ model::gateway::{GatewayIntents, Ready}, Client, }; -use skynet_discord_bot::{db_init, get_config, get_data::get_wolves, Config, DataBase}; +use skynet_discord_bot::{db_init, get_config, get_data::get_wolves_cns, Config, DataBase}; use std::{process, sync::Arc}; use tokio::sync::RwLock; @@ -43,7 +43,8 @@ impl EventHandler for Handler { let ctx = Arc::new(ctx); println!("{} is connected!", ready.user.name); - get_wolves(&ctx).await; + // get the data for each individual club/soc + get_wolves_cns(&ctx).await; // finish up process::exit(0); diff --git a/src/commands/add_server.rs b/src/commands/add_server.rs index e1e7ca4..817d61a 100644 --- a/src/commands/add_server.rs +++ b/src/commands/add_server.rs @@ -6,7 +6,7 @@ use serenity::{ prelude::{command::CommandOptionType, interaction::application_command::CommandDataOptionValue}, }, }; -use skynet_discord_bot::get_data::get_wolves; +use skynet_discord_bot::get_data::get_wolves_cns; use skynet_discord_bot::{get_server_config, is_admin, set_roles::update_server, DataBase, Servers}; use sqlx::{Error, Pool, Sqlite}; @@ -147,7 +147,7 @@ async fn add_server(db: &Pool, ctx: &Context, server: &Servers) -> Resul // update all users if update { // handle wolves api here - get_wolves(ctx).await; + get_wolves_cns(ctx).await; let mut roles_remove = vec![]; if current_remove { diff --git a/src/lib.rs b/src/lib.rs index c0d980a..a247d33 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -523,7 +523,7 @@ pub mod get_data { pub email: String, pub expiry: String, } - pub async fn get_wolves(ctx: &Context) { + pub async fn get_wolves_cns(ctx: &Context) { let db_lock = { let data_read = ctx.data.read().await; data_read.get::().expect("Expected Database in TypeMap.").clone() @@ -548,7 +548,7 @@ pub mod get_data { // list of users that need to be updated for this server let mut user_to_update = vec![]; - for user in get_wolves_sub(&config, wolves_api).await { + for user in get_wolves_cns_sub(&config, wolves_api).await { let id = user.member_id.parse::().unwrap_or_default(); match existing.get(&(id as i64)) { None => { @@ -594,7 +594,7 @@ pub mod get_data { .unwrap_or_default() } - async fn get_wolves_sub(config: &Config, wolves_api: &str) -> Vec { + async fn get_wolves_cns_sub(config: &Config, wolves_api: &str) -> Vec { if config.wolves_url.is_empty() { return vec![]; }