Compare commits
4 commits
4453e5291e
...
671566a690
Author | SHA1 | Date | |
---|---|---|---|
Yash Karandikar | 671566a690 | ||
Yash Karandikar | 7c8f8c8f6d | ||
Yash Karandikar | 3d50da90fb | ||
Yash Karandikar | 28767f4d68 |
|
@ -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
|
||||
|
|
16
src/main.rs
16
src/main.rs
|
@ -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(())
|
||||
|
|
Loading…
Reference in a new issue