| Crates.io | fluxus-sink-telegram |
| lib.rs | fluxus-sink-telegram |
| version | 0.1.0 |
| created_at | 2025-05-14 03:36:36.865662+00 |
| updated_at | 2025-05-14 03:36:36.865662+00 |
| description | A Telegram sink component for the Fluxus stream processing framework, enabling real-time message delivery to Telegram channels and chats. |
| homepage | https://github.com/fluxus-labs/fluxus-sink-telegram |
| repository | https://github.com/fluxus-labs/fluxus-sink-telegram |
| max_upload_size | |
| id | 1672848 |
| size | 88,361 |
A Telegram sink component for the Fluxus stream processing framework, enabling real-time message delivery to Telegram channels and chats.
Add this to your Cargo.toml:
[dependencies]
fluxus-sink-telegram = "0.1"
use fluxus_sink_telegram::TelegramSink;
use fluxus::sinks::Sink;
use fluxus::utils::models::Record;
use std::time::SystemTime;
fn current_time() -> i64 {
SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap()
.as_secs() as i64
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Initialize the Telegram sink
let mut sink = TelegramSink::new(
"YOUR_BOT_TOKEN".to_string(),
"@your_channel".to_string(),
None, // Optional proxy
)?;
let record = Record {
data: "Hello from Fluxus!".to_string(),
timestamp: current_time(),
};
// Send a message
sink.write(record).await?;
Ok(())
}
let mut sink = TelegramSink::new(
"YOUR_BOT_TOKEN".to_string(),
"@your_channel".to_string(),
Some("http://proxy.example.com:8080".to_string()),
)?;
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.