Skip to content
This repository was archived by the owner on Oct 23, 2021. It is now read-only.

Commit 8332201

Browse files
Updated README.md
1 parent 1a84e1b commit 8332201

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

README.md

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,40 @@
1+
12
# Java-DiscordRPC
23

3-
This library contains Java bindings for Discord's Rich Presence API (https://github.com/discordapp/discord-rpc) using JNA.
4+
This library contains Java bindings for [Discord's official RPC SDK](https://github.com/discordapp/discord-rpc) using JNA.
45

5-
It is currently specific to the Windows 64 bit platform.
6+
This project provides binaries for `linux-x86-64` and `win32-x86-64`.
67

78
## Examples
8-
Here is an example on how to use the API.
99

1010
```java
11-
DiscordRPC lib = DiscordRPC.INSTANCE;
12-
String applicationId = "";
13-
String steamId = "";
14-
DiscordEventHandlers handlers = new DiscordEventHandlers();
15-
handlers.ready = () -> System.out.println("Ready!");
16-
lib.Discord_Initialize(applicationId, handlers, true, steamId);
17-
DiscordRichPresence presence = new DiscordRichPresence();
18-
presence.startTimestamp = System.currentTimeMillis() / 1000; // epoch second
19-
presence.details = "Testing RPC";
20-
lib.Discord_UpdatePresence(presence);
21-
// in a worker thread
22-
while (!Thread.currentThread().isInterrupted())
23-
lib.Discord_RunCallbacks();
11+
import club.minnced.discord.rpc.*;
12+
13+
public class Main {
14+
15+
public static void main(String[] args) {
16+
DiscordRPC lib = DiscordRPC.INSTANCE;
17+
String applicationId = "";
18+
String steamId = "";
19+
DiscordEventHandlers handlers = new DiscordEventHandlers();
20+
handlers.ready = () -> System.out.println("Ready!");
21+
lib.Discord_Initialize(applicationId, handlers, true, steamId);
22+
DiscordRichPresence presence = new DiscordRichPresence();
23+
presence.startTimestamp = System.currentTimeMillis() / 1000; // epoch second
24+
presence.details = "Testing RPC";
25+
lib.Discord_UpdatePresence(presence);
26+
// in a worker thread
27+
new Thread(() -> {
28+
while (!Thread.currentThread().isInterrupted()) {
29+
lib.Discord_RunCallbacks();
30+
try {
31+
Thread.sleep(2000);
32+
} catch (InterruptedException ignored) {}
33+
}
34+
}, "RPC-Callback-Handler").start();
35+
}
36+
37+
}
2438
```
2539

2640
## License

0 commit comments

Comments
 (0)