pub struct TelegramChannel {
pub token: String,
pub client: Client,
pub chat_id: Option<String>,
pub offset: Arc<Mutex<i64>>,
}Fields§
§token: String§client: Client§chat_id: Option<String>§offset: Arc<Mutex<i64>>Implementations§
Source§impl TelegramChannel
impl TelegramChannel
pub fn new(token: String, chat_id: Option<String>) -> Result<Self>
pub async fn send_inline_keyboard( &self, chat_id: i64, topic_id: Option<i64>, text: &str, buttons: &[(String, String)], ) -> Result<i64>
pub async fn answer_callback_query( &self, callback_query_id: &str, text: &str, ) -> Result<()>
Trait Implementations§
Source§impl Channel for TelegramChannel
impl Channel for TelegramChannel
Source§fn start<'life0, 'async_trait>(
&'life0 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 self,
) -> Pin<Box<dyn Future<Output = Result<Receiver<IncomingMessage>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start listening for incoming messages.
Returns a receiver that the engine polls.
Source§fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 OutgoingMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
msg: &'life1 OutgoingMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Send a message to a thread/conversation.
Source§fn ack_interaction<'life0, 'life1, 'async_trait>(
&'life0 self,
callback_query_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn ack_interaction<'life0, 'life1, 'async_trait>(
&'life0 self,
callback_query_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Acknowledge an interactive callback to dismiss the loading indicator. Read more
Auto 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
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