Skip to content

Commit 54a5e47

Browse files
committed
tgbot 0.17
1 parent 93d0a98 commit 54a5e47

File tree

3 files changed

+3
-22
lines changed

3 files changed

+3
-22
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ log = "0.4"
3030
nonzero_ext = { version = "0.3", optional = true }
3131
seance = { version = "0.6", optional = true }
3232
serde = { version = "1.0", optional = true }
33-
tgbot = "0.16"
33+
tgbot = "0.17"
3434
tokio = "1.16"
3535

3636
[dev-dependencies]

examples/app/main.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use carapax::{longpoll::LongPoll, Api, App, Chain, Config, Context, ErrorExt, HandlerError};
1+
use carapax::{longpoll::LongPoll, Api, App, Chain, Context, ErrorExt, HandlerError};
22
use dotenv::dotenv;
33
use seance::{backend::fs::FilesystemBackend, SessionCollector, SessionManager};
44
use std::{env, time::Duration};
@@ -17,8 +17,7 @@ async fn main() {
1717
dotenv().ok();
1818
env_logger::init();
1919

20-
let config = create_config();
21-
let api = Api::new(config).expect("Failed to create API");
20+
let api = Api::new(get_env("CARAPAX_TOKEN")).expect("Failed to create API");
2221

2322
let mut context = Context::default();
2423
context.insert(api.clone());
@@ -52,16 +51,6 @@ fn get_env(s: &str) -> String {
5251
env::var(s).unwrap_or_else(|_| panic!("{} is not set", s))
5352
}
5453

55-
fn create_config() -> Config {
56-
let token = get_env("CARAPAX_TOKEN");
57-
let proxy = env::var("CARAPAX_PROXY").ok();
58-
let mut config = Config::new(token);
59-
if let Some(proxy) = proxy {
60-
config = config.proxy(proxy).expect("Failed to set proxy");
61-
}
62-
config
63-
}
64-
6554
fn create_session_backend() -> FilesystemBackend {
6655
let tmpdir = tempdir().expect("Failed to create temp directory");
6756
log::info!("Session directory: {}", tmpdir.path().display());

sample.env

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ RUST_LOG=info
55
# A telegram bot token
66
CARAPAX_TOKEN=YOUR-BOT-TOKEN-HERE
77

8-
# Proxy:
9-
#
10-
# * http://\[user:password\]@host:port
11-
# * https://\[user:password\]@host:port
12-
# * socks4://userid@host:port
13-
# * socks5://\[user:password\]@host:port
14-
# CARAPAX_PROXY='socks5://user:password@host:port'
15-
168
# Updates will be denied for all except given username
179
# Specify a username without @
1810
#CARAPAX_ACCESS_USERNAME=username

0 commit comments

Comments
 (0)