MinnDevelopment / java-discord-rpc

Java bindings for https://github.com/discordapp/discord-rpc (using JNA)
Apache License 2.0
134 stars 36 forks source link

[Request/Help] Function to check if an Image Exists? #26

Closed CDAGaming closed 6 years ago

CDAGaming commented 6 years ago

Hi :)

This isnt an issue really, but I'm just wondering for an App I'm working on, if there is a way to check to see if an image key is equal to a Large or Small Image or if there is no image with the specific image key.

m-sterling commented 6 years ago

Hi there, CDAGaming!

If I'm understanding your issue right, within your DiscordRichPresence object, you can get the current image keys and compare them to whatever you need to. smallImageKey and largeImageKey are just normal String objects, so you would be able to compare them against other strings as normal.

If I misunderstood you, and instead you're asking if you're able to tell if a key has a valid image asset for the application, then I regret to inform you that it is not possible. What happens when you use an invalid key is unknown to me, though it should be very easy to test it yourself.

If I still misunderstood you (which is more than likely possible; it's 1:30 in the morning by me at the time of me writing this, haha), please clarify what you meant and I'll have an answer for you ASAP. Cheers!

CDAGaming commented 6 years ago

It was the 2nd thing you explained, what i was trying to do

Since it uses an invalid key, it makes the largeImage and smallImage both disappear. If it is impossible for it to tell if it has a valid asset, Could this perhaps be changed/fixed so that only the smallImage wouldn't work, and not both the Images.

m-sterling commented 6 years ago

Ah, this is more of an issue with the official Discord RPC library and less of an issue with this Java implementation library. I suggest opening an issue there for this issue.