Class DiscordService

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    @Singleton
    public class DiscordService
    extends java.lang.Object
    implements java.lang.AutoCloseable
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clearPresence()
      Clears the currently set presence.
      void close()
      Shuts the RPC connection down.
      net.runelite.discord.DiscordUser getCurrentUser()  
      void init()
      Initializes the Discord service, sets up the event handlers and starts worker thread that will poll discord events every 2 seconds.
      void respondToRequest​(java.lang.String userId, int reply)
      Responds to the given user with the specified reply type.
      void updatePresence​(DiscordPresence discordPresence)
      Updates the currently set presence of the logged in user.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 java.lang.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​(java.lang.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
      • getCurrentUser

        public net.runelite.discord.DiscordUser getCurrentUser()