mirror of
https://github.com/teloxide/teloxide.git
synced 2024-10-24 01:47:08 +02:00
Add Box::ctx
shortcut
This commit is contained in:
parent
300a3cb285
commit
fedc346e23
1 changed files with 9 additions and 8 deletions
|
@ -23,15 +23,19 @@ impl Bot {
|
|||
client,
|
||||
}
|
||||
}
|
||||
|
||||
fn ctx(&self) -> RequestContext {
|
||||
RequestContext {
|
||||
token: &self.token,
|
||||
client: &self.client,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Telegram functions
|
||||
impl Bot {
|
||||
pub fn get_me(&self) -> GetMe {
|
||||
GetMe::new(RequestContext {
|
||||
token: &self.token,
|
||||
client: &self.client,
|
||||
})
|
||||
GetMe::new(self.ctx())
|
||||
}
|
||||
|
||||
pub fn send_message<C, T>(&self, chat_id: C, text: T) -> SendMessage
|
||||
|
@ -40,10 +44,7 @@ impl Bot {
|
|||
T: Into<String>,
|
||||
{
|
||||
SendMessage::new(
|
||||
RequestContext {
|
||||
token: &self.token,
|
||||
client: &self.client,
|
||||
},
|
||||
self.ctx(),
|
||||
chat_id.into(),
|
||||
text.into(),
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue