From 4a7ab5082ffec7b4ec2ecd0d84c18bc1d62b7d09 Mon Sep 17 00:00:00 2001 From: AmokDev Date: Fri, 21 Mar 2025 14:56:27 +0300 Subject: [PATCH] fixed: if discord closed - client not change status to 'false' --- Cargo.toml | 2 +- src/client/ipc.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f2e9193..7e40b49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rust-discord-rpc" description = "A lightweight library to control Discord Rich Presence" -version = "0.3.2" +version = "0.3.3" edition = "2021" authors = ["Dylan Cattelan "] license = "MIT" diff --git a/src/client/ipc.rs b/src/client/ipc.rs index 936c723..4fc75ef 100644 --- a/src/client/ipc.rs +++ b/src/client/ipc.rs @@ -60,7 +60,15 @@ impl DiscordClient { "nonce": uuid::Uuid::new_v4().to_string(), }); - Ok(self.send(payload, OpCode::MESSAGE as u8)?) + match self.send(payload, OpCode::MESSAGE as u8) { + Ok(retval) => { + Ok(retval) + }, + Err(e) => { + self.is_connected = false; + Err(e) + }, + } } fn socket(&mut self) -> &mut PipeClient {