MinnDevelopment / java-discord-rpc

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

Documentation and README #1

Closed MinnDevelopment closed 6 years ago

MinnDevelopment commented 6 years ago

This currently has no README or documentation on how to use this library.

Philipp0002 commented 6 years ago

Is the API already working? If yes I'd like to get a little instruction, because I can't get it to work. If I get it working then, I can help you creating a documentation/wiki.

MinnDevelopment commented 6 years ago

yes it works as described in the official documentation

MinnDevelopment commented 6 years ago

Here is a basic example

DiscordRPC lib = DiscordRPC.INSTANCE;
String applicationId = "";
String steamId = "";
DiscordEventHandlers handlers = new DiscordEventHandlers();
handlers.ready = () -> System.out.println("Ready!");
lib.Discord_Initialize(applicationId, handlers, true, steamId);
DiscordRichPresence presence = new DiscordRichPresence();
presence.startTimestamp = System.currentTimeMillis() / 1000; // epoch second
presence.details = "Testing RPC";
lib.Discord_UpdatePresence(presence);
// in a worker thread
while (!Thread.currentThread().isInterrupted())
    lib.Discord_RunCallbacks();
Notoh commented 6 years ago

Made a readme #2

MinnDevelopment commented 6 years ago

I have added javadoc in PR #6