fix toml errors

This commit is contained in:
Alie 2023-07-14 10:57:53 +02:00
parent 6915e9a967
commit 325b9eadde
2 changed files with 11 additions and 9 deletions

View File

@ -1,12 +1,12 @@
[Bot] [bot]
name = "sleeping-girls-bot" name = "dev-sleeping-girls-bot"
instance = "https://awoo.fai.st" instance = "https://awoo.fai.st"
bio = "Bot who posts images of sleeping girls every 6 hours." bio = "Bot who posts images of sleeping girls every 6 hours."
[Config] [filess]
urls = "./urls.csv" urls = "./urls.csv"
posted = "./posted.csv" posted = "./posted.csv"
tempfile = "./.tmp" tempfile = "./.tmp"
[Errors] [errors]
out-of-images = "@Sugui@awoo.fai.st @MeDueleLaTeta@awoo.fai.st me quedé sin chicas" out_of_images = "@Sugui@awoo.fai.st @MeDueleLaTeta@awoo.fai.st me quedé sin chicas"

View File

@ -87,7 +87,7 @@ fn get_next_url(config: &Config) -> Option<String> {
async fn post_image(account: &Mastodon, url: &String, config: &Config) { async fn post_image(account: &Mastodon, url: &String, config: &Config) {
fetch_url(url.to_string(), &config.files.tempfile) fetch_url(url.to_string(), &config.files.tempfile)
.await .await
.unwrap(); .expect("Error fetching url");
let attachment = account let attachment = account
.media(&config.files.tempfile, Some(url.to_string())) .media(&config.files.tempfile, Some(url.to_string()))
.await .await
@ -102,7 +102,8 @@ async fn post_image(account: &Mastodon, url: &String, config: &Config) {
.sensitive(true) .sensitive(true)
.build() .build()
.unwrap(); .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) { async fn update_bio(account: &Mastodon, config: &Config) {
@ -136,8 +137,9 @@ async fn post(account: &Mastodon, msg: &str) {
.visibility(Visibility::Direct) .visibility(Visibility::Direct)
.status(msg) .status(msg)
.build() .build()
.unwrap(); .expect("Error building error status");
account.new_status(status).await.unwrap(); account.new_status(status).await.expect("Error posting error status");
println!("Error status posted")
} }
async fn fetch_url(url: String, file_name: &String) -> Result<()> { async fn fetch_url(url: String, file_name: &String) -> Result<()> {