fix: rename `get_wolves
` to be just for clubs/socs
This commit is contained in:
parent
9452c0ac2e
commit
04a487cd8f
3 changed files with 8 additions and 7 deletions
|
@ -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);
|
||||
|
|
|
@ -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<Sqlite>, 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 {
|
||||
|
|
|
@ -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::<DataBase>().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::<u64>().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<WolvesResultUser> {
|
||||
async fn get_wolves_cns_sub(config: &Config, wolves_api: &str) -> Vec<WolvesResultUser> {
|
||||
if config.wolves_url.is_empty() {
|
||||
return vec![];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue