feat: make VCsWatcher, a watch channel of VCs
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
use clap::Parser;
|
||||
use fomo_reducer::{
|
||||
BotDataManager, CommandRouter, GuildVoiceChannelToTextChannel, State, Storage, UserDataManager,
|
||||
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};
|
||||
@@ -316,7 +315,7 @@ async fn main() -> Result<(), MainError> {
|
||||
|
||||
let discord_client = Arc::new(discord_client);
|
||||
let songbird = Arc::new(songbird);
|
||||
let vcs = Arc::new(vcs);
|
||||
let vcs_watcher = VCsWatcher::new(vcs);
|
||||
|
||||
let bot_data = bot_data.into_inner();
|
||||
let recording_data = recording_data.into_inner();
|
||||
@@ -358,7 +357,7 @@ async fn main() -> Result<(), MainError> {
|
||||
recording_data,
|
||||
songbird,
|
||||
user_data_manager,
|
||||
vcs,
|
||||
vcs_watcher,
|
||||
};
|
||||
|
||||
if let Some(discord_status) = discord_status {
|
||||
@@ -455,7 +454,7 @@ async fn handle_event(command_router: Arc<CommandRouter>, state: State, event: E
|
||||
|
||||
match event {
|
||||
Event::VoiceStateUpdate(voice_state_update) => {
|
||||
update_vcs(&voice_state_update, &state.vcs);
|
||||
state.vcs_watcher.send_modify(|vcs| update_vcs(&voice_state_update, vcs));
|
||||
}
|
||||
Event::InteractionCreate(interaction_create) => {
|
||||
let InteractionCreate(interaction) = *interaction_create;
|
||||
|
||||
Reference in New Issue
Block a user