From 45cf90be5a197cae50e20a959beee777cc961335 Mon Sep 17 00:00:00 2001 From: Radiicall <66682497+Radiicall@users.noreply.github.com> Date: Sat, 26 Aug 2023 15:46:39 +0200 Subject: [PATCH 1/2] Cap string length --- src/services/jellyfin.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/services/jellyfin.rs b/src/services/jellyfin.rs index 7a32dc3..45ac2fd 100644 --- a/src/services/jellyfin.rs +++ b/src/services/jellyfin.rs @@ -121,6 +121,15 @@ impl Content { Content::watching(&mut content, now_playing_item, config).await; + // Check that details and state_message arent over the max length allowed by discord, if they are then they have to be trimmed down because discord wont display the activity otherwise + if content.details.len() > 128 { + content.details(content.details[0..128].to_string()); + } + + if content.state_message.len() > 128 { + content.state_message(content.state_message[0..128].to_string()); + } + let mut image_url: String = "".to_string(); if config .images From fd13325db42d0dcde590a29b86e6b35eb86617f2 Mon Sep 17 00:00:00 2001 From: Radiicall <66682497+Radiicall@users.noreply.github.com> Date: Sat, 26 Aug 2023 16:00:10 +0200 Subject: [PATCH 2/2] bump version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 51f8324..084ac6c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -487,7 +487,7 @@ checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "jellyfin-rpc" -version = "0.14.4" +version = "0.14.5" dependencies = [ "clap", "colored", diff --git a/Cargo.toml b/Cargo.toml index 8b2ec90..076ace3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jellyfin-rpc" -version = "0.14.4" +version = "0.14.5" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html