Compare commits

...

4 commits

Author SHA1 Message Date
Yash Karandikar 671566a690
Update README.md 2022-01-03 15:20:40 -06:00
Yash Karandikar 7c8f8c8f6d
Run rustfmt 2022-01-03 15:20:03 -06:00
Yash Karandikar 3d50da90fb
Handle JOIN and PART/QUIT 2022-01-03 15:19:53 -06:00
Yash Karandikar 28767f4d68
Update README 2022-01-03 14:58:10 -06:00
2 changed files with 17 additions and 0 deletions

View file

@ -3,6 +3,7 @@
A very simple Discord-IRC bridge written in Rust. Still very much work-in-progress.
TODO:
- [x] handle join and leave messages
- [] use the tracing crate
- [] `irc` crate config toml
- [] handle attachments properly

View file

@ -207,6 +207,22 @@ async fn irc_loop(
.say(&http, format!("{}: {}", nickname, message))
.await?;
}
} else if let Command::JOIN(_, _, _) = orig_message.command {
let nickname = orig_message.source_nickname().unwrap();
channel_id
.say(&http, format!("*{}* has joined the channel", nickname))
.await?;
} else if let Command::PART(_, ref reason) | Command::QUIT(ref reason) =
orig_message.command
{
let nickname = orig_message.source_nickname().unwrap();
let reason = reason
.as_ref()
.unwrap_or(&String::from("Connection closed"))
.to_string();
channel_id
.say(&http, format!("*{}* has quit ({})", nickname, reason))
.await?;
}
}
Ok(())