diff --git a/config.toml b/config.toml index 946f71f..8d4433f 100644 --- a/config.toml +++ b/config.toml @@ -1,12 +1,12 @@ -[Bot] -name = "sleeping-girls-bot" +[bot] +name = "dev-sleeping-girls-bot" instance = "https://awoo.fai.st" bio = "Bot who posts images of sleeping girls every 6 hours." -[Config] +[filess] urls = "./urls.csv" posted = "./posted.csv" tempfile = "./.tmp" -[Errors] -out-of-images = "@Sugui@awoo.fai.st @MeDueleLaTeta@awoo.fai.st me quedé sin chicas" \ No newline at end of file +[errors] +out_of_images = "@Sugui@awoo.fai.st @MeDueleLaTeta@awoo.fai.st me quedé sin chicas" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 6ed6e25..0dddc20 100644 --- a/src/main.rs +++ b/src/main.rs @@ -87,7 +87,7 @@ fn get_next_url(config: &Config) -> Option { async fn post_image(account: &Mastodon, url: &String, config: &Config) { fetch_url(url.to_string(), &config.files.tempfile) .await - .unwrap(); + .expect("Error fetching url"); let attachment = account .media(&config.files.tempfile, Some(url.to_string())) .await @@ -102,7 +102,8 @@ async fn post_image(account: &Mastodon, url: &String, config: &Config) { .sensitive(true) .build() .unwrap(); - account.new_status(status).await.unwrap(); + account.new_status(status).await.expect("Error generating status"); + println!("Status posted") } async fn update_bio(account: &Mastodon, config: &Config) { @@ -136,8 +137,9 @@ async fn post(account: &Mastodon, msg: &str) { .visibility(Visibility::Direct) .status(msg) .build() - .unwrap(); - account.new_status(status).await.unwrap(); + .expect("Error building error status"); + account.new_status(status).await.expect("Error posting error status"); + println!("Error status posted") } async fn fetch_url(url: String, file_name: &String) -> Result<()> {