solana_scanner/src/telegram_publish.rs
Alexandre RAY-BERNAT 99b958c48b
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Retrieves social infos + post on Telegram
2025-05-23 15:14:46 +02:00

20 lines
467 B
Rust

use reqwest::Client;
pub async fn send_to_telegram(bot_token: &str, chat_id: &str, message: &str) -> Result<(), Box<dyn std::error::Error>> {
let url = format!("https://api.telegram.org/bot{}/sendMessage", bot_token);
let params = [
("chat_id", chat_id),
("text", message),
("parse_mode", "Markdown")
];
let client = Client::new();
client.post(&url)
.form(&params)
.send()
.await?;
Ok(())
}