mirror of
https://github.com/szymon-jozef/checkers.git
synced 2026-10-28 11:10:44 +01:00
feat: add sending text messages
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use std::io;
|
||||
|
||||
use checkers::network::client::Client;
|
||||
|
||||
#[tokio::main]
|
||||
@@ -5,7 +7,20 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
env_logger::init();
|
||||
|
||||
let mut client: Client = Client::new().await;
|
||||
client.update().await;
|
||||
client.update();
|
||||
|
||||
println!("=== Write to stding to send text messages ===");
|
||||
println!("Write /close to leave");
|
||||
let mut buffer = String::new();
|
||||
loop {
|
||||
io::stdin().read_line(&mut buffer)?;
|
||||
if buffer == "/close\n" {
|
||||
break;
|
||||
}
|
||||
|
||||
client.send_text_message(buffer.clone()).await;
|
||||
buffer.clear();
|
||||
}
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user