Skip to main content

Telegram

Trait Telegram 

Source
pub trait Telegram: Send + Sync {
    // Required method
    fn send(&self, chat_id: ChatId, message: Message);

    // Provided method
    fn send_text(&self, chat_id: ChatId, text: &str) { ... }
}
Expand description

Sends outbound Telegram notifications.

Sending is deliberately synchronous and infallible: a notification must never block a request handler, and there is rarely anything upstream which could act on a delivery failure anyway. Failures surface through tracing instead, which reaches Sentry through the usual subscriber.

Required Methods§

Source

fn send(&self, chat_id: ChatId, message: Message)

Queues a message for delivery to a chat.

Returns immediately. The message is chunked, paced against Telegram’s rate limits, retried on transient failure, and finally delivered on a background task.

Provided Methods§

Source

fn send_text(&self, chat_id: ChatId, text: &str)

Queues an unformatted message.

Convenience for the common case where no formatting is needed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§