pub struct TelegramChannel { /* private fields */ }Implementations§
Source§impl TelegramChannel
impl TelegramChannel
pub fn new(bot_token: String, chat_id: i64) -> Self
Sourcepub fn with_api_base(self, base: impl Into<String>) -> Self
pub fn with_api_base(self, base: impl Into<String>) -> Self
Point the Telegram API at another origin (conformance tests).
pub fn with_memory(self, memory: Arc<dyn MemoryBackend>) -> Self
pub fn with_ingress_filter(self, ingress: TelegramIngressFilter) -> Self
Sourcepub async fn send_message(&self, text: &str) -> Result<i64>
pub async fn send_message(&self, text: &str) -> Result<i64>
Send a message and return its message_id (of the last chunk if split)
Sourcepub async fn edit_message(&self, message_id: i64, text: &str) -> Result<()>
pub async fn edit_message(&self, message_id: i64, text: &str) -> Result<()>
Edit an existing message
Sourcepub async fn delete_message(&self, message_id: i64) -> Result<()>
pub async fn delete_message(&self, message_id: i64) -> Result<()>
Delete a message
Sourcepub async fn send_typing(&self, _chat_id: &str) -> Result<()>
pub async fn send_typing(&self, _chat_id: &str) -> Result<()>
Send typing indicator
Trait Implementations§
Source§impl Channel for TelegramChannel
impl Channel for TelegramChannel
Source§fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Receiver<IncomingMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<Receiver<IncomingMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start receiving messages. Returns a receiver for incoming messages.
Source§fn send<'life0, 'async_trait>(
&'life0 self,
message: OutgoingMessage,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
message: OutgoingMessage,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a message through this channel. Returns an optional message ID for tracking/editing.
Source§fn supports_media(&self) -> bool
fn supports_media(&self) -> bool
Whether
send_media will do anything for this channel. Callers that can
fall back to text should check this instead of sending and catching.Source§fn send_media<'life0, 'async_trait>(
&'life0 self,
media: OutgoingMedia,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_media<'life0, 'async_trait>(
&'life0 self,
media: OutgoingMedia,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send an attachment. Read more
Source§fn send_typing<'life0, 'life1, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_typing<'life0, 'life1, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a typing indicator (or equivalent) to the user.
Source§fn edit<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_chat_id: &'life1 str,
message_id: &'life2 str,
new_text: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn edit<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_chat_id: &'life1 str,
message_id: &'life2 str,
new_text: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Edit a previously sent message if the channel supports it.
Source§impl Clone for TelegramChannel
impl Clone for TelegramChannel
Source§fn clone(&self) -> TelegramChannel
fn clone(&self) -> TelegramChannel
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for TelegramChannel
impl !UnwindSafe for TelegramChannel
impl Freeze for TelegramChannel
impl Send for TelegramChannel
impl Sync for TelegramChannel
impl Unpin for TelegramChannel
impl UnsafeUnpin for TelegramChannel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more