12 releases
0.6.2 | Oct 28, 2024 |
---|---|
0.6.1 |
|
0.5.0 | Mar 25, 2023 |
0.4.4 | Jun 3, 2021 |
0.1.2 | May 29, 2021 |
#550 in Command-line interface
262 downloads per month
8KB
148 lines
tw-econ
Description
Rust library provides you a simple synchronous interface to interconnect with Teeworlds external console.
Example
Let's say you have Teeworlds server running with ec_password zohan
and ec_port 6060
and you want to use it's econ.
use tw_econ::Econ;
fn main() -> std::io::Result<()> {
let mut econ = Econ::new();
econ.connect("127.0.0.1:6060")?;
let authed = econ.try_auth("nahoz")?;
assert_eq!(authed, false);
let authed = econ.try_auth("hozan")?;
assert_eq!(authed, false);
let authed = econ.try_auth("zohan")?;
assert_eq!(authed, true);
econ.send_line("echo \"Hi\"")?;
println!("{}", econ.recv_line(true)?);
Ok(())
}