1
- use carapax:: { longpoll:: LongPoll , Api , App , Chain , Config , Context , ErrorExt , HandlerError } ;
1
+ use carapax:: { longpoll:: LongPoll , Api , App , Chain , Context , ErrorExt , HandlerError } ;
2
2
use dotenv:: dotenv;
3
3
use seance:: { backend:: fs:: FilesystemBackend , SessionCollector , SessionManager } ;
4
4
use std:: { env, time:: Duration } ;
@@ -17,8 +17,7 @@ async fn main() {
17
17
dotenv ( ) . ok ( ) ;
18
18
env_logger:: init ( ) ;
19
19
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" ) ;
22
21
23
22
let mut context = Context :: default ( ) ;
24
23
context. insert ( api. clone ( ) ) ;
@@ -52,16 +51,6 @@ fn get_env(s: &str) -> String {
52
51
env:: var ( s) . unwrap_or_else ( |_| panic ! ( "{} is not set" , s) )
53
52
}
54
53
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
-
65
54
fn create_session_backend ( ) -> FilesystemBackend {
66
55
let tmpdir = tempdir ( ) . expect ( "Failed to create temp directory" ) ;
67
56
log:: info!( "Session directory: {}" , tmpdir. path( ) . display( ) ) ;
0 commit comments