prep: skeleton to handle roles changing from other means

This commit is contained in:
silver 2024-09-29 21:04:08 +01:00
parent 42f301455a
commit ec74dc0aa7
Signed by: silver
GPG key ID: 36F93D61BAD3FD7D

View file

@ -13,7 +13,7 @@ use serenity::{
Client,
};
use std::sync::Arc;
use serenity::model::guild::Member;
use skynet_discord_bot::{db_init, get_config, get_server_config, get_server_member, Config, DataBase};
use tokio::sync::RwLock;
@ -21,6 +21,7 @@ struct Handler;
#[async_trait]
impl EventHandler for Handler {
// handles previously linked accounts joining the server
async fn guild_member_addition(&self, ctx: Context, mut new_member: guild::Member) {
let db_lock = {
let data_read = ctx.data.read().await;
@ -120,6 +121,25 @@ Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use
}
}
}
// handles role updates
async fn guild_member_update(&self, _ctx: Context, _old_if_available: Option<Member>, _new: Member){
if let Some(x) = _old_if_available {
if x.roles.len() != _new.roles.len() {
return;
}
//do we need to do more comparison here?
}
// get config/db
// check if the role changed is part of the oens for this server
// if so add or remove the resultant one
// TODO: Finish
}
}
#[tokio::main]