Rich presence visualizer java

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

presence

Here are 13 public repositories matching this topic.

Vatuu / discord-rpc

Java Wrapper of the Discord-RPC Library for Discord Rich Presence.

jagrosh / DiscordIPC

Connect locally to the Discord client using IPC for a subset of RPC features like Rich Presence and Activity Join/Spectate

ostrya / PresencePublisher

An Android MQTT client that regularly publishes messages to notify about the device’s presence

depascaldc / Java-DiscordRPC-GUI

A Java GUI to manage Discord’s Rich Presence

tmlong / webCoRE-Presence

putrabangga / WifiPresence

Get your employee presence only with their phone and your wifi access point.

rizhalmaulana / presence-app-with-svm-and-geofance-firebase

Aplikasi Absensi berbasis Android dengan Geofence dan SVM Klasifikasi.

TheMartinfer22 / CustomDiscordRPC

👩‍🔧 Um proejto simples que possibilita o RPC do Discord de maneira customizada por arquivo properties.

Читайте также:  Все методы функции python

TheArKaID / Presonmu

Presensi Online Mubaligh Hijrah Unires with MySQL

JampireX / DiscordPresence

App for keeping discord Rich Presence active

robertene1994 / unioviscope-android

Anroid application for attendance control.

robertene1994 / unioviscope-back-end

Back-end application for attendance control.

geronald10 / INPIS

«INPIS — Indonesian Navy Personnel Information System» merupakan aplikasi desktop berbasis Java berupa sistem kepegawaian TNI AL yang dibuat untuk final proyek matakuliah MPPL (Manajemen Proyek Perangkat Lunak)

Improve this page

Add a description, image, and links to the presence topic page so that developers can more easily learn about it.

Add this topic to your repo

To associate your repository with the presence topic, visit your repo’s landing page and select «manage topics.»

Источник

MrPowerGamerBR / main.kt

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

import net.dv8tion.jda.core.AccountType
import net.dv8tion.jda.core.JDABuilder
import java.io.File
import net.dv8tion.jda.core.WebSocketCode
import net.dv8tion.jda.core.entities.impl.JDAImpl
import org.json.JSONObject
fun main ( args : Array < String >)
val token = File ( » D: \\ discord_token.txt » ).readText()
val jda = JDABuilder ( AccountType . CLIENT ).setToken(token).buildBlocking()
val jdaImpl = jda as JDAImpl
val jsonObject = JSONObject ()
jsonObject.put( » afk » , false )
jsonObject.put( » status » , » dnd » )
jsonObject.put( » since » , System .currentTimeMillis())
val gameObj = JSONObject ()
gameObj.put( » name » , » Between Calmness And Passion » )
gameObj.put( » type » , 0 )
gameObj.put( » state » , » Testing stuff » )
gameObj.put( » details » , » something something something™ » )
gameObj.put( » application_id » , » 358402218577231875 » )
val assetsObj = JSONObject ()
assetsObj.put( » large_image » , » 358403188958953472 » )
assetsObj.put( » small_image » , » 358403380076478464 » )
assetsObj.put( » large_text » , » Loritta :3 » )
assetsObj.put( » small_text » , » wow, magic » )
gameObj.put( » assets » , assetsObj)
jsonObject.put( » game » , gameObj)
System . out . println (jsonObject)
jdaImpl.client.send( JSONObject ()
.put( » d » , jsonObject)
.put( » op » , WebSocketCode . PRESENCE ).toString())
>

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Vatuu / discord-rpc Public archive

Java Wrapper of the Discord-RPC Library for Discord Rich Presence.

License

Vatuu/discord-rpc

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

This project is discontinued and will no longer be maintained as the DiscordRPC has been deprecated. It has been replaced by the GameSDK which has wrappers maintained by people unrelated to this project. Please stop using this library, and refrain from creating issues or PRs as they will likely not be resolved or merged.

Java Wrapper of the Discord-RPC Library for Discord Rich Presence.

Ever wanted to use the Discord Rich Presence API in a Java Application, but then realized that the native version is C++ only? Well, worry no more, because Vatuu’s Discord RPC is here. A complete wrapper of all functions the native Dynamic Library contains.

Set advanced pieces of information about your game in the players’ profile, when they use your Application, from text to images, timers and even giving the option of joining/spectating a game!

The so-called Rich Presence contains the following fields for you to fill in:

  • State: The general state the current play-session is in (Waiting, Playing, Watching some leaderboards, etc).
  • Details: Details to the current play-session, like the location, or current score.
  • Timestamps: Show how long the current game-session will go, or how long the player is already playing, up to you.
  • Images: One big cubic, and one smaller round images with a custom tooltip text, to show some more details.
  • Parties: Show the current size of parties or lobbies to indicate if the player is forever alone or not.
  • Match/Join/Spectate: Some super secret Strings that are needed for joining and spectating a game. More to that below.
  • Instance Int: If it’s a game instance or not, as simple as that.

Using this wrapper is as simple as it can be, with barely any difference of the «original» API.

Download one of the releases or download the sources to build your own release. Then, simply add and include it in your project.

Currently supported OS include Windows x86 , Windows x64 and Unix x64 . OSX and macOS support is currently broken, although we’re working hard on getting it to work again.

Initialize the Discord RPC when your Application starts up. The Library is mostly static, so there is no need to create an Instance. The DiscordRPC.discordInitialize(); method takes 3 arguments to start.

  • Client ID is the ID of your Discord Application.
  • Handler is an instance of a DiscordEventHandler-Object. Callbacks to HandlerClasses are registered in there.
  • AutoRegister does not really matter right now and is always true .
  • If your application is a Steam Application, the Initialize Methods takes another String of your Steam App ID.

The Event Handler contains instances of the classes that handle Callbacks of the DiscordRPC. These classes have to implement the appropriate Interface for the Callback. The Callback-Interfaces are the following:

  • DisconnectedCallback
  • ErroredCallback
  • JoinGameCallback
  • JoinRequestCallback
  • ReadyCallback
  • SpectateGameCallback

To register a Callback, simply follow the following code:

public static class ReadyEvent implements ReadyCallback < public void apply() < System.out.println("Discord's ready!"); > > public class MainClass < public void startup() < DiscordEventHandlers handlers = new DiscordEventHandlers.Builder().setReadyEventHandler((user) -> < System.out.println("Welcome " + user.username + "#" + user.discriminator + "!"); >).build(); > >

All Callbacks are optional. You only need to register Classes that implement the Callbacks you need, or if you don’t need any, simply pass an empty DiscordEventHandler Object.

public void startup() < DiscordEventHandlers handlers = new DiscordEventHandlers.Builder().setReadyEventHandler((user) -> < System.out.println("Welcome " + user.username + "#" + user.discriminator + "!"); >).build(); DiscordRPC.discordInitialize("1234567890", handlers, true); >

This would result in the message «Welcome User#1234!» being printed out in the console after the connection to Discord has been established, and fitted with the users username and discriminator.

To allow callbacks to be fired, you have to periodically call the method DiscordRPC.discordRunCallbacks(); . Otherwise, no callbacks will be passed to the application.

Congratulations, your Application is ready to utilize the Rich Presence.

To update the Rich Presence of a player, a DiscordRichPresence Object is required. There are created in the same way as the EventHandler is created, by using a Builder:

public void createNewPresence() < DiscordRichPresence rich = new DiscordRichPresence.Builder("This is the current state.").setDetails("These are some details.").build(); >

After the Object has been created, it simply has to be passed to the DiscordRPC with the methods DiscordRPC.discordUpdatePresence(DiscordRichPresence);

public void createNewPresence() < DiscordRichPresence rich = new DiscordRichPresence.Builder("This is the current state.").setDetails("These are some details.").build(); DiscordRPC.discordUpdatePresence(rich); >

After calling that method, the presence of the player will have updated, according to the information passed. Just like the EventHandler before, all fields are optional and can be left empty if one desires so. Just keep in mind that a Match- Join- and Spectate Secret are needed when utilizing the Join and Spectate features.

More information regarding the fields of the Rich Presence and the correct usage of them can be found HERE.

To allow the IOStream utilized by the RPC to close properly, the method DiscordRPC.discordShutdown(); should always be called on exit of your application, otherwise issues might occure.

The method DiscordRPC.discordRespond(String userId, DiscordReply reply); handles the reply on a JoinRequest by a player. When a player requests to join a game, the JoinRequestCallback is called, which should be used to process the request. That request contains the Username, UserID and the avatar of that user transformed into a SHA-1 hash.

Important Note: To let a application use the Spectate Feature, the application has to be greenlit by the Discord Developers. Otherwise, only certain users added to the Application will be able to use these features.

For further information regarding joining, spectating and getting greenlit, please visit THIS PAGE.

Contained in this repository is a .JAR file called RPCTest.jar . This simple command line application can be used to test the Rich Presence for yourself! Simply add the Application named «RPCTest» to your Discord Games, and it will be recognized. Since Discord only detects games that have an active window, I discourage you from closing the small window called «Derp» that will pop up as soon as you start the RPCTest.

The RPCTest has only two commands:

  • test will increase the «score» value in the details of your presence.
  • shutdown is self-explanatory.

More questions? I recommend checking the official Discord Developer Docs.

Best regards, Vatuu

Источник

Оцените статью