feat: use values from teh env file to dictate the servers
This commit is contained in:
parent
72226cc59b
commit
a6eff75e39
5 changed files with 33 additions and 29 deletions
|
@ -282,7 +282,7 @@ pub mod link {
|
|||
pub mod verify {
|
||||
use super::*;
|
||||
use crate::commands::wolves::link::{db_pending_clear_expired, get_server_member_discord, get_verify_from_db};
|
||||
use serenity::all::{CommandDataOption, CommandDataOptionValue, CommandInteraction, GuildId, RoleId};
|
||||
use serenity::all::{CommandDataOption, CommandDataOptionValue, CommandInteraction};
|
||||
use serenity::model::user::User;
|
||||
use skynet_discord_bot::common::database::get_server_config;
|
||||
use skynet_discord_bot::common::database::{ServerMembersWolves, Servers};
|
||||
|
@ -429,12 +429,18 @@ pub mod verify {
|
|||
}
|
||||
|
||||
async fn set_server_roles_committee(db: &Pool<Sqlite>, discord: &User, ctx: &Context) {
|
||||
let config_lock = {
|
||||
let data_read = ctx.data.read().await;
|
||||
data_read.get::<Config>().expect("Expected Config in TypeMap.").clone()
|
||||
};
|
||||
let config = config_lock.read().await;
|
||||
|
||||
if let Some(x) = get_server_member_discord(db, &discord.id).await {
|
||||
// if they are a member of one or more committees, and in teh committee server then give the teh general committee role
|
||||
// they will get teh more specific vanity role later
|
||||
if !get_committees_id(db, x.id_wolves).await.is_empty() {
|
||||
let server = GuildId::new(1220150752656363520);
|
||||
let committee_member = RoleId::new(1226602779968274573);
|
||||
let server = config.committee_server;
|
||||
let committee_member = config.committee_role;
|
||||
|
||||
if let Ok(member) = server.member(ctx, &discord.id).await {
|
||||
member.add_roles(&ctx, &[committee_member]).await.unwrap_or_default();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue