Connect locally to the Discord client using IPC for a subset of RPC features like Rich Presence and Activity Join/Spectate
- Setting Rich Presence
- Buttons
- Detect and specify priority for client build (Stable, PTB, Canary)
- 100% Java
First you'll need to add this project as a dependency. If you're using maven:
<dependency>
<groupId>me.cutenyami</groupId>
<artifactId>DiscordIPC-Buttons</artifactId>
<version>1.0.0</version>
</dependency>
<repository>
<url>https://tykopvp.com</url>
</repository>
With gradle:
dependencies {
compileOnly 'me.cutenyami:DiscordIPC-Buttons:1.0.0'
}
repositories {
maven {
url = "https://tykopvp.com"
}
}
Quick example, assuming you already have a GUI application
IPCClient client = new IPCClient(345229890980937739L); // your client id
client.setListener(new IPCListener() {
@Override
public void onReady(IPCClient client) {
RichPresence.Builder builder = new RichPresence.Builder();
builder.setState("State")
.setDetails("Details")
.setButton1Text("Discord")
.setButton1Url("https://discord.com")
.setButton2Text("Google")
.setButton2Url("https://google.com")
.setStartTimestamp(OffsetDateTime.now())
.setLargeImage("canary-large", "Discord Canary")
.setSmallImage("ptb-small", "Discord PTB");
client.sendRichPresence(builder.build());
}
});
client.connect();
The official RPC bindings can be found here: https://github.com/discordapp/discord-rpc
A Java wrapper for the official bindings is available here: https://github.com/MinnDevelopment/Java-DiscordRPC