Skip to content

Commit

Permalink
Remove camera::Id enum
Browse files Browse the repository at this point in the history
  • Loading branch information
cofob committed Aug 12, 2024
1 parent b3dbc14 commit 6d5d3ab
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/modules/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ use teloxide::utils::command::BotCommands;
use crate::common::{filter_command, BotCommandsExt, BotEnv, UpdateHandler};
use crate::utils::{read_camera_image, BotExt};

enum Id {
Racovina,
Hlam,
}

#[derive(Clone, BotCommands, BotCommandsExt!)]
#[command(rename_rule = "snake_case")]
pub enum Commands {
Expand All @@ -37,8 +32,8 @@ async fn start<'a>(
command: Commands,
) -> Result<()> {
match command {
Commands::Racovina => camera(bot, env, msg, Id::Racovina).await?,
Commands::Hlam => camera(bot, env, msg, Id::Hlam).await?,
Commands::Racovina => camera(bot, env, msg, command).await?,
Commands::Hlam => camera(bot, env, msg, command).await?,
}
Ok(())
}
Expand All @@ -47,11 +42,11 @@ async fn camera(
bot: Bot,
env: Arc<BotEnv>,
msg: Message,
camera_id: Id,
camera_id: Commands,
) -> Result<()> {
let camera_config = match camera_id {
Id::Racovina => &env.config.services.racovina_cam,
Id::Hlam => &env.config.services.vortex_of_doom_cam,
Commands::Racovina => &env.config.services.racovina_cam,
Commands::Hlam => &env.config.services.vortex_of_doom_cam,
};

let image = match read_camera_image(
Expand Down

0 comments on commit 6d5d3ab

Please sign in to comment.