Package net.runelite.client.discord
Class DiscordService
- java.lang.Object
-
- net.runelite.client.discord.DiscordService
-
- All Implemented Interfaces:
AutoCloseable
@Singleton public class DiscordService extends Object implements 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(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.
-
-
-
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 callclose()
-
close
public void close()
Shuts the RPC connection down. If not currently connected, this does nothing.- Specified by:
close
in interfaceAutoCloseable
-
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 toreply
- The reply type- See Also:
DiscordRPC.DISCORD_REPLY_NO
,DiscordRPC.DISCORD_REPLY_YES
,DiscordRPC.DISCORD_REPLY_IGNORE
-
getCurrentUser
public net.runelite.discord.DiscordUser getCurrentUser()
-
-