feat: new committee member joins the committee server they automagically get roles
This commit is contained in:
parent
f1138a3c81
commit
32249364ff
1 changed files with 9 additions and 0 deletions
|
@ -15,8 +15,10 @@ use serenity::{
|
||||||
};
|
};
|
||||||
use skynet_discord_bot::{get_config, Config};
|
use skynet_discord_bot::{get_config, Config};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use serenity::model::id::GuildId;
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
use skynet_discord_bot::common::database::{db_init, get_server_config, get_server_member, DataBase};
|
use skynet_discord_bot::common::database::{db_init, get_server_config, get_server_member, DataBase};
|
||||||
|
use skynet_discord_bot::common::set_roles::committee::update_committees;
|
||||||
|
|
||||||
struct Handler;
|
struct Handler;
|
||||||
|
|
||||||
|
@ -35,6 +37,13 @@ impl EventHandler for Handler {
|
||||||
Some(x) => x,
|
Some(x) => x,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// committee server takes priority
|
||||||
|
if new_member.guild_id.eq(&GuildId(1220150752656363520)) {
|
||||||
|
let mut member = vec![new_member.clone()];
|
||||||
|
update_committees(&db, &ctx, &mut member).await;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if get_server_member(&db, &new_member.guild_id, &new_member).await.is_ok() {
|
if get_server_member(&db, &new_member.guild_id, &new_member).await.is_ok() {
|
||||||
let mut roles = vec![];
|
let mut roles = vec![];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue