diff --git a/Cargo.toml b/Cargo.toml index bb6fb53..b79b19c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rust-discord-activity" description = "A lightweight library to control Discord Rich Presence" -version = "0.2.0" +version = "0.3.0" edition = "2021" authors = ["Dylan Cattelan for more info pub id: String, + + /// Boolean stating if Client is connected to Discord App. + pub is_connected: bool, + + /// Unix Stream socket of Client Connection. socket: Option, } @@ -23,6 +28,7 @@ impl DiscordClient { pub fn new(id: &str) -> Self { Self { id: id.to_string(), + is_connected: false, socket: None, } } @@ -35,9 +41,13 @@ impl DiscordClient { Ok(socket) => { self.socket = Some(socket); self.handshake().expect("Could not handshake."); + self.is_connected = true; Ok(()) } - Err(_) => Err(DiscordNotFound), + Err(_) => { + self.is_connected = false; + Err(DiscordNotFound) + } } }