mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
Use sound_bot in client_from_env
This commit is contained in:
parent
aa0b2c7d1e
commit
0fae235597
1 changed files with 10 additions and 1 deletions
|
@ -1,10 +1,17 @@
|
|||
use crate::bot::sound_bot;
|
||||
|
||||
/// Constructs a client from the `TELOXIDE_PROXY` environmental variable.
|
||||
///
|
||||
/// This function passes the value of `TELOXIDE_PROXY` into
|
||||
/// [`reqwest::Proxy::all`], if it exists, otherwise returns the default
|
||||
/// client.
|
||||
///
|
||||
/// # Note
|
||||
/// The created client will have safe settings, meaning that it will be able to
|
||||
/// work in long time durations, see the [issue 223].
|
||||
///
|
||||
/// [`reqwest::Proxy::all`]: https://docs.rs/reqwest/latest/reqwest/struct.Proxy.html#method.all
|
||||
/// [issue 223]: https://github.com/teloxide/teloxide/issues/223
|
||||
pub fn client_from_env() -> reqwest::Client {
|
||||
use reqwest::{Client, Proxy};
|
||||
|
||||
|
@ -13,6 +20,8 @@ pub fn client_from_env() -> reqwest::Client {
|
|||
.proxy(Proxy::all(&proxy).expect("creating reqwest::Proxy"))
|
||||
.build()
|
||||
.expect("creating reqwest::Client"),
|
||||
None => Client::new(),
|
||||
None => sound_bot(),
|
||||
}
|
||||
.build()
|
||||
.expect("creating reqwest::Client")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue