Add configuration and database setup
- Updated Cargo.toml with necessary dependencies - Enhanced config.rs with database and application configuration - Updated main.rs with improved bot initialization - Added development database file
This commit is contained in:
@@ -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",
|
||||
|
||||
BIN
pawctioneer_bot_dev.db
Normal file
BIN
pawctioneer_bot_dev.db
Normal file
Binary file not shown.
@@ -26,8 +26,8 @@ impl Config {
|
||||
///
|
||||
/// The configuration is automatically validated during construction.
|
||||
pub fn from_env() -> Result<Self> {
|
||||
// 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")?;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user