mirror of https://github.com/MedzikUser/imgurs
rustfmt
This commit is contained in:
parent
06a908ff36
commit
ef1f9342ee
|
@ -2,7 +2,7 @@ use super::clipboard::set_clipboard;
|
||||||
use imgurs::api::{upload_image::upload_image as upload_img, ImgurClient};
|
use imgurs::api::{upload_image::upload_image as upload_img, ImgurClient};
|
||||||
use notify_rust::Notification;
|
use notify_rust::Notification;
|
||||||
|
|
||||||
use crate::{config::toml, cli::webhook::send_discord_webhook};
|
use crate::{cli::webhook::send_discord_webhook, config::toml};
|
||||||
|
|
||||||
use super::print_image_info;
|
use super::print_image_info;
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ pub async fn upload_image(client: ImgurClient, path: &str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.discord_webhook.enabled {
|
if config.discord_webhook.enabled {
|
||||||
send_discord_webhook(i.data.link, i.data.deletehash.unwrap()).await.expect("send discord webhook");
|
send_discord_webhook(i.data.link, i.data.deletehash.unwrap())
|
||||||
|
.await
|
||||||
|
.expect("send discord webhook");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,17 +3,30 @@ use webhook::client::WebhookClient;
|
||||||
|
|
||||||
use crate::config::toml;
|
use crate::config::toml;
|
||||||
|
|
||||||
pub async fn send_discord_webhook(link: String, deletehash: String) -> Result<bool, Box<dyn Error + Send + Sync>> {
|
pub async fn send_discord_webhook(
|
||||||
|
link: String,
|
||||||
|
deletehash: String,
|
||||||
|
) -> Result<bool, Box<dyn Error + Send + Sync>> {
|
||||||
let url = toml::parse().discord_webhook.uri;
|
let url = toml::parse().discord_webhook.uri;
|
||||||
let client: WebhookClient = WebhookClient::new(&url);
|
let client: WebhookClient = WebhookClient::new(&url);
|
||||||
|
|
||||||
let webhook = client.send(|message| message
|
let webhook = client
|
||||||
.username("Imgurs")
|
.send(|message| {
|
||||||
.embed(|embed| embed
|
message.username("Imgurs").embed(|embed| {
|
||||||
.title("Imgurs")
|
embed
|
||||||
.description(&format!("Delete Hash ||{deletehash}||"))
|
.title("Imgurs")
|
||||||
.image(&link)
|
.description(&format!("Delete Hash ||{deletehash}||"))
|
||||||
.footer(&format!("Imgurs v{}", option_env!("CARGO_PKG_VERSION").unwrap_or("unknown")), None))).await;
|
.image(&link)
|
||||||
|
.footer(
|
||||||
|
&format!(
|
||||||
|
"Imgurs v{}",
|
||||||
|
option_env!("CARGO_PKG_VERSION").unwrap_or("unknown")
|
||||||
|
),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.await;
|
||||||
|
|
||||||
webhook
|
webhook
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue