Class DiscordIPC

java.lang.Object
meteordevelopment.discordipc.DiscordIPC

public class DiscordIPC extends Object
  • Constructor Details

    • DiscordIPC

      public DiscordIPC()
  • Method Details

    • setOnError

      public static void setOnError(BiConsumer<Integer,String> onError)
      Sets the error callback
    • start

      public static boolean start(long appId, Runnable onReady)
      Tries to open a connection to a locally running Discord instance
      Parameters:
      appId - the application id to use
      onReady - callback called when a successful connection happens, from that point getUser() will return non-null object up until stop() is called or an error happens
      Returns:
      true if a connection was opened successfully
    • isConnected

      public static boolean isConnected()
      Returns:
      true if it is currently connected to a local Discord instance
    • getUser

      public static IPCUser getUser()
      Returns:
      the user that is logged in in the connected Discord instance
    • setActivity

      public static void setActivity(RichPresence presence)
      Sets account's activity
      Parameters:
      presence - the rich presence to set the activity to
    • stop

      public static void stop()
      Closes the connection to the locally running Discord instance if it is open