feat: use values from teh env file to dictate the servers

This commit is contained in:
silver 2025-06-16 21:50:26 +01:00
parent 72226cc59b
commit a6eff75e39
Signed by untrusted user: silver
GPG key ID: 36F93D61BAD3FD7D
5 changed files with 33 additions and 29 deletions

View file

@ -1,9 +1,7 @@
pub mod commands;
use crate::commands::role_adder::tools::on_role_change;
use serenity::all::{
ActivityData, Command, CommandDataOptionValue, CreateMessage, EditInteractionResponse, GuildId, GuildMemberUpdateEvent, Interaction,
};
use serenity::all::{ActivityData, Command, CommandDataOptionValue, CreateMessage, EditInteractionResponse, GuildMemberUpdateEvent, Interaction};
use serenity::model::guild::Member;
use serenity::{
async_trait,
@ -42,7 +40,7 @@ impl EventHandler for Handler {
let config_global = config_lock.read().await;
// committee server takes priority
let committee_server = GuildId::new(1220150752656363520);
let committee_server = config_global.committee_server;
if new_member.guild_id.get() == committee_server.get() {
let mut member = vec![new_member.clone()];
update_committees(&db, &ctx, &config_global, &mut member).await;
@ -113,6 +111,12 @@ Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use
println!("[Main] {} is connected!", ready.user.name);
ctx.set_presence(Some(ActivityData::playing("with humanity's fate")), OnlineStatus::Online);
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;
match Command::set_global_commands(
&ctx.http,
vec![
@ -132,10 +136,7 @@ Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use
}
// Inter-Committee server
match GuildId::new(1220150752656363520)
.set_commands(&ctx.http, vec![commands::count::committee::register()])
.await
{
match config.committee_server.set_commands(&ctx.http, vec![commands::count::committee::register()]).await {
Ok(_) => {}
Err(e) => {
println!("{:?}", e)
@ -143,7 +144,8 @@ Sign up on [UL Wolves]({}) and go to https://discord.com/channels/{}/{} and use
}
// compsoc Server
match GuildId::new(689189992417067052)
match config
.compsoc_server
.set_commands(
&ctx.http,
vec![