Resolved #901 DiscordRPC length issues

This commit is contained in:
Core 2022-04-20 12:49:06 +01:00
parent 8b7b8c3dbf
commit 295da6a757
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6

View file

@ -137,11 +137,21 @@ export default class DiscordRPC {
}
})
// Checks if the name is greater than 128 because some songs can be that long
if (activity.details && activity.details.length > 128) {
// Checks if the details is greater than 128 because some songs can be that long
if (activity.details && activity.details.length >= 128) {
activity.details = activity.details.substring(0, 125) + '...'
}
// Checks if the state is greater than 128 because some songs can be that long
if (activity.state && activity.state.length >= 128) {
activity.state = activity.state.substring(0, 125) + '...'
}
// Checks if the state is greater than 128 because some songs can be that long
if (activity.largeImageText && activity.largeImageText.length >= 128) {
activity.largeImageText = activity.largeImageText.substring(0, 125) + '...'
}
// Check large image
if (activity.largeImageKey == null || activity.largeImageKey === "" || activity.largeImageKey.length > 256) {
activity.largeImageKey = "cider";