y6_rotating_bot/
y6_rotating_bot.rs

1use asciicker_rs::y6::prelude::*;
2
3#[tokio::main]
4async fn main() {
5    let bot = Bot::new("player", "ws://asciicker.com/ws/y6/", true);
6    let (threads, data) = match bot.run().await {
7        Err(e) => panic!("Failed to run the bot: {:?}", e),
8        Ok(stuff) => stuff,
9    };
10    let mut i: f32 = 0f32;
11    loop {
12        match *threads.0.is_finished.lock().await {
13            true => {
14                println!("{:?}", threads.0.thread.await);
15                return;
16            }
17            _ => {}
18        };
19        let mut bot = data.0.lock().await;
20        bot.pose.direction = i;
21        i += 0.01f32;
22        if i >= 360f32 {
23            i = 0f32;
24        }
25    }
26}