Skip to content

Commit

Permalink
Simplify camera code
Browse files Browse the repository at this point in the history
  • Loading branch information
cofob committed Aug 12, 2024
1 parent 6d5d3ab commit bc3d926
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/modules/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,16 @@ pub enum Commands {
}

pub fn command_handler() -> UpdateHandler {
filter_command::<Commands>().endpoint(start)
}

async fn start<'a>(
bot: Bot,
env: Arc<BotEnv>,
msg: Message,
command: Commands,
) -> Result<()> {
match command {
Commands::Racovina => camera(bot, env, msg, command).await?,
Commands::Hlam => camera(bot, env, msg, command).await?,
}
Ok(())
filter_command::<Commands>().endpoint(camera)
}

async fn camera(
bot: Bot,
env: Arc<BotEnv>,
msg: Message,
camera_id: Commands,
command: Commands,
) -> Result<()> {
let camera_config = match camera_id {
let camera_config = match command {
Commands::Racovina => &env.config.services.racovina_cam,
Commands::Hlam => &env.config.services.vortex_of_doom_cam,
};
Expand Down

0 comments on commit bc3d926

Please sign in to comment.