use std::time::Duration;
use nurtex::{Bot, BotChatExt, Cluster, JoinDelay};
#[tokio::main]
async fn main() -> std::io::Result<()> {
let mut cluster = Cluster::create();
for s_ind in 0..3 {
let mut bots = Vec::new();
for b_ind in 0..2 {
bots.push(Bot::create(format!("nurtex_{}_{}", s_ind, b_ind)));
}
cluster.add_swarm(bots, JoinDelay::fixed(1000), "localhost", 25565);
}
cluster.launch();
tokio::time::sleep(Duration::from_secs(5)).await;
cluster.for_each_bots_parallel(async |bot| {
bot.chat_message(format!("Привет, я {}!", bot.username())).await
});
tokio::time::sleep(Duration::from_secs(5)).await;
Ok(())
}