Class DiscordService

    • Method Detail

      • init

        public void init()
        Initializes the Discord service, sets up the event handlers and starts worker thread that will poll discord events every 2 seconds. Before closing the application it is recommended to call close()
      • close

        public void close()
        Shuts the RPC connection down. If not currently connected, this does nothing.
        Specified by:
        close in interface AutoCloseable
      • updatePresence

        public void updatePresence​(DiscordPresence discordPresence)
        Updates the currently set presence of the logged in user.
        Note that the client only updates its presence every 15 seconds and queues all additional presence updates.
        Parameters:
        discordPresence - The new presence to use
      • clearPresence

        public void clearPresence()
        Clears the currently set presence.
      • respondToRequest

        public void respondToRequest​(String userId,
                                     int reply)
        Responds to the given user with the specified reply type.
        Parameters:
        userId - The id of the user to respond to
        reply - The reply type
        See Also:
        DiscordRPC.DISCORD_REPLY_NO, DiscordRPC.DISCORD_REPLY_YES, DiscordRPC.DISCORD_REPLY_IGNORE