fix toml errors
This commit is contained in:
parent
6915e9a967
commit
325b9eadde
10
config.toml
10
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"
|
||||
[errors]
|
||||
out_of_images = "@Sugui@awoo.fai.st @MeDueleLaTeta@awoo.fai.st me quedé sin chicas"
|
10
src/main.rs
10
src/main.rs
|
@ -87,7 +87,7 @@ fn get_next_url(config: &Config) -> Option<String> {
|
|||
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<()> {
|
||||
|
|
Loading…
Reference in New Issue