Skip to content

Commit

Permalink
128 character length limit (#58)
Browse files Browse the repository at this point in the history
Discord caps the activity to 128 characters, anything above that will not display on discord
  • Loading branch information
Radiicall authored Aug 26, 2023
1 parent fc25152 commit e742662
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/services/jellyfin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e742662

Please sign in to comment.