| Crates.io | lichessbot |
| lib.rs | lichessbot |
| version | 0.1.36 |
| created_at | 2021-01-13 16:10:07.754601+00 |
| updated_at | 2021-02-01 18:37:00.80498+00 |
| description | Lichess bot. Under construction. |
| homepage | https://github.com/hyperchessbot/lichessbot#lichessbot |
| repository | https://github.com/hyperchessbot/lichessbot |
| max_upload_size | |
| id | 341428 |
| size | 75,433 |
Lichess bot. Under construction.
use log::{info, log_enabled, 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(())
}
export RUST_LOG=info
# or
export RUST_LOG=debug
Set environment as follows:
RUST_BOT_TOKEN={lichess API token with bot scopes}
RUST_BOT_NAME={bot lichess username}
example
RUST_BOT_NAME=chesshyperbot
RUST_BOT_ENGINE_NAME={engine executable name}
examples
Linux RUST_BOT_ENGINE_NAME=./stockfish12
Windows RUST_BOT_ENGINE_NAME=stockfish12.exe
If no engine name is provided, random moves will be played.