diff --git a/src/command/info.rs b/src/command/info.rs index f4b160f..7bdc82b 100644 --- a/src/command/info.rs +++ b/src/command/info.rs @@ -26,21 +26,19 @@ pub static COMMAND: LazyLock = LazyLock::new(|| { .build() }); - #[tracing::instrument] pub async fn handle(state: State, interaction: Interaction) { let revision = build_info::COMMIT_HASH; let bot_owner_user_id = state.discord_bot_owner_user_id; - let is_bot_owner = - interaction - .member - .as_ref() - .and_then(|member| member.user.as_ref().map(|user| user.id)) - .map(|user_id| user_id == bot_owner_user_id) - .unwrap_or(false); - + let is_bot_owner = interaction + .member + .as_ref() + .and_then(|member| member.user.as_ref().map(|user| user.id)) + .map(|user_id| user_id == bot_owner_user_id) + .unwrap_or(false); + let bot_owner_mention = format!("<@{}>", bot_owner_user_id); let opt_in_mention = format!( @@ -58,7 +56,7 @@ pub async fn handle(state: State, interaction: Interaction) { .create_response( interaction.id, &interaction.token, - &InteractionResponse { + &InteractionResponse { kind: InteractionResponseType::ChannelMessageWithSource, data: Some( InteractionResponseDataBuilder::new().embeds([ @@ -87,7 +85,7 @@ pub async fn handle(state: State, interaction: Interaction) { }) .await .expect("TODO"); - + if is_bot_owner { let heat_script_description = state .bot_data_manager diff --git a/src/main.rs b/src/main.rs index a411583..f912b8f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ use clap::Parser; use fomo_reducer::{ - BotDataManager, CommandRouter, GuildVoiceChannelToTextChannel, State, Storage, UserDataManager, VCsWatcher, all_commands, command, initialize_vcs, update_vcs + BotDataManager, CommandRouter, GuildVoiceChannelToTextChannel, State, Storage, UserDataManager, + VCsWatcher, all_commands, command, initialize_vcs, update_vcs, }; use secrecy::{ExposeSecret, SecretString}; use snafu::{OptionExt, ResultExt, Snafu}; @@ -461,7 +462,9 @@ async fn handle_event(command_router: Arc, state: State, event: E match event { Event::VoiceStateUpdate(voice_state_update) => { - state.vcs_watcher.send_modify(|vcs| update_vcs(&voice_state_update, vcs)); + state + .vcs_watcher + .send_modify(|vcs| update_vcs(&voice_state_update, vcs)); } Event::InteractionCreate(interaction_create) => { let InteractionCreate(interaction) = *interaction_create; diff --git a/src/track_vcs.rs b/src/track_vcs.rs index 2741db2..8f142a3 100644 --- a/src/track_vcs.rs +++ b/src/track_vcs.rs @@ -15,7 +15,8 @@ use crate::{OneToManyUniqueBTreeMapWithData, OneToOneBTreeMap, UserInVCData, Voi pub type GuildVoiceChannelToTextChannel = BTreeMap, OneToOneBTreeMap, Id>>; -pub type VCsInGuild = OneToManyUniqueBTreeMapWithData, Id, UserInVCData>; +pub type VCsInGuild = + OneToManyUniqueBTreeMapWithData, Id, UserInVCData>; pub type VCs = BTreeMap, VCsInGuild>; pub type VCsWatcher = watch::Sender; @@ -108,7 +109,9 @@ pub fn update_vcs(voice_state_update: &VoiceStateUpdate, vcs: &mut VCs) { .build(); let user_in_vc_data = voice_status.into(); - vcs.entry(guild_id).or_default().insert(channel_id, user_id, user_in_vc_data); + vcs.entry(guild_id) + .or_default() + .insert(channel_id, user_id, user_in_vc_data); tracing::info!( ?guild_id,