|
|
|
@ -92,6 +92,9 @@ fn receive(mut stream: &TcpStream) -> std::io::Result<()> {
|
|
|
|
|
match res_string {
|
|
|
|
|
Ok(r) => {
|
|
|
|
|
if !res_string.unwrap().is_empty() {
|
|
|
|
|
if std::fs::File::open("irc.log").is_err() {
|
|
|
|
|
let _ = std::fs::write("irc.log", "");
|
|
|
|
|
}
|
|
|
|
|
let mut f = OpenOptions::new()
|
|
|
|
|
.append(true)
|
|
|
|
|
.open("irc.log")
|
|
|
|
@ -199,6 +202,14 @@ impl Client {
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn send_tune(&self) -> std::io::Result<()> {
|
|
|
|
|
let mut stream = connect(self.nick.to_owned())?;
|
|
|
|
|
thread::spawn(move || {
|
|
|
|
|
let _ = stream.write(b"PRIVMSG #wownero-music !tune\r\n");
|
|
|
|
|
});
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Creates a send and recv TcpStream (with the same socket)
|
|
|
|
|
/// spins recv to its own thread
|
|
|
|
|
/// main thread takes user input and matches it to commands
|
|
|
|
|