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 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;
|
||||
|
||||
|
@ -50,6 +50,8 @@ pub async fn upload_image(client: ImgurClient, path: &str) {
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
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 client: WebhookClient = WebhookClient::new(&url);
|
||||
|
||||
let webhook = client.send(|message| message
|
||||
.username("Imgurs")
|
||||
.embed(|embed| embed
|
||||
let webhook = client
|
||||
.send(|message| {
|
||||
message.username("Imgurs").embed(|embed| {
|
||||
embed
|
||||
.title("Imgurs")
|
||||
.description(&format!("Delete Hash ||{deletehash}||"))
|
||||
.image(&link)
|
||||
.footer(&format!("Imgurs v{}", option_env!("CARGO_PKG_VERSION").unwrap_or("unknown")), None))).await;
|
||||
.footer(
|
||||
&format!(
|
||||
"Imgurs v{}",
|
||||
option_env!("CARGO_PKG_VERSION").unwrap_or("unknown")
|
||||
),
|
||||
None,
|
||||
)
|
||||
})
|
||||
})
|
||||
.await;
|
||||
|
||||
webhook
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue