diff --git a/Cargo.toml b/Cargo.toml index 320923e..a493287 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -teloxide = { version = "0.17.0", features = ["macros"] } +teloxide = { version = "0.17.0", features = ["macros", "ctrlc_handler"] } tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } sqlx = { version = "0.8.6", features = [ "runtime-tokio-rustls", diff --git a/pawctioneer_bot_dev.db b/pawctioneer_bot_dev.db new file mode 100644 index 0000000..20629ed Binary files /dev/null and b/pawctioneer_bot_dev.db differ diff --git a/src/config.rs b/src/config.rs index 99554c0..f39743b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -26,8 +26,8 @@ impl Config { /// /// The configuration is automatically validated during construction. pub fn from_env() -> Result { - // Load .env file if present (fails silently if not found) - let _ = dotenvy::dotenv(); + dotenvy::dotenv()?; + env_logger::init(); let telegram_token = env::var("TELOXIDE_TOKEN") .context("TELOXIDE_TOKEN environment variable is required")?; diff --git a/src/main.rs b/src/main.rs index 0e6237a..5ba5d67 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,13 +28,8 @@ pub enum Command { Settings, } -// No longer needed - dptree will dispatch directly! - #[tokio::main] async fn main() -> Result<()> { - // Initialize logging - env_logger::init(); - // Load and validate configuration from environment/.env file let config = Config::from_env()?; @@ -42,7 +37,6 @@ async fn main() -> Result<()> { let db_pool = config.create_database_pool().await?; info!("Starting Pawctioneer Bot..."); - let bot = Bot::new(&config.telegram_token); // Create dispatcher with direct command routing