1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//!
//! # Examples
//!
//!
//!```
//!use log::{log_enabled, info, Level};
//!
//!extern crate env_logger;
//!
//!use dotenv::dotenv;
//!
//!use lichessbot::lichessbot::*;
//!
//!#[tokio::main]
//!async fn main() -> Result<(), Box<dyn std::error::Error>>{
//!	dotenv().ok();
//!	env_logger::init();
//!
//!	let bot = Box::leak(Box::new(LichessBot::new()
//!		.uci_opt("Move Overhead", 500)
//!		.uci_opt("Threads", 4)
//!		.uci_opt("Hash", 128)
//!		.uci_opt("Contempt", -25)
//!		.enable_classical(false)
//!		.enable_rapid(false)
//!		.disable_blitz(false)
//!		.disable_bullet(false)
//!		.enable_ultrabullet(false)
//!		.enable_casual(true)
//!		.disable_rated(false)
//!	));
//!	
//!	if log_enabled!(Level::Info){
//!		info!("starting bot stream");
//!	}
//!
//!	let (tx, mut rxa) = bot.stream().await;
//!
//!	tokio::time::sleep(tokio::time::Duration::from_millis(120000)).await;
//!
//!	let _ = tx.send("stopped by user".to_string()).await;
//!
//!	let result = rxa.recv().await;
//!
//!	if log_enabled!(Level::Info) {
//!		info!("stop stream result {:?}", result);
//!	}
//!
//!	Ok(())
//!}
//!
//!```


// lib
pub mod lichessbot;