Add Discord RPC service

Add injectable Discord RPC service that will broadcast Discord events
through event bus and have API for setting Discord Rich Presence status.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-02-03 20:08:56 +01:00
parent 80aebd1836
commit 15ad949123
14 changed files with 647 additions and 8 deletions

View File

@@ -32,18 +32,18 @@ import com.google.inject.Injector;
import java.applet.Applet;
import java.io.File;
import java.util.Optional;
import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Singleton;
import javax.swing.SwingUtilities;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.client.events.ClientUILoaded;
import net.runelite.client.account.SessionManager;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.discord.DiscordService;
import net.runelite.client.events.ClientUILoaded;
import net.runelite.client.menus.MenuManager;
import net.runelite.client.plugins.PluginManager;
import net.runelite.client.ui.ClientUI;
@@ -78,9 +78,6 @@ public class RuneLite
@Inject
private ChatMessageManager chatMessageManager;
@Inject
private ScheduledExecutorService executor;
@Inject
private OverlayRenderer overlayRenderer;
@@ -90,6 +87,9 @@ public class RuneLite
@Inject
private RuneLiteConfig runeliteConfig;
@Inject
private DiscordService discordService;
Client client;
ClientUI gui;
Notifier notifier;
@@ -133,6 +133,9 @@ public class RuneLite
// Load swing UI
SwingUtilities.invokeAndWait(() -> setGui(ClientUI.create(properties, client)));
// Initialize Discord service
discordService.init();
// Load default configuration
configManager.load();

View File

@@ -36,14 +36,13 @@ import net.runelite.api.Client;
import net.runelite.client.account.SessionManager;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.game.ItemManager;
import net.runelite.client.menus.MenuManager;
import net.runelite.client.plugins.PluginManager;
import net.runelite.client.task.Scheduler;
import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.client.util.QueryRunner;
import net.runelite.client.config.RuneLiteConfig;
@Slf4j
public class RuneLiteModule extends AbstractModule
@@ -56,7 +55,6 @@ public class RuneLiteModule extends AbstractModule
bind(MenuManager.class);
bind(ChatMessageManager.class);
bind(ItemManager.class);
bind(InfoBoxManager.class);
bind(Scheduler.class);
bind(PluginManager.class);
bind(RuneLiteProperties.class);

View File

@@ -39,6 +39,7 @@ public class RuneLiteProperties
private static final String RUNELITE_TITLE = "runelite.title";
private static final String RUNELITE_VERSION = "runelite.version";
private static final String RUNESCAPE_VERSION = "runescape.version";
private static final String DISCORD_APP_ID = "runelite.discord.appid";
private final Properties properties = new Properties();
@@ -70,4 +71,9 @@ public class RuneLiteProperties
{
return properties.getProperty(RUNESCAPE_VERSION);
}
public String getDiscordAppId()
{
return properties.getProperty(DISCORD_APP_ID);
}
}

View File

@@ -0,0 +1,147 @@
/*
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.discord;
import java.time.Instant;
import lombok.Builder;
import lombok.Value;
/**
* Represents Discord Rich Presence RPC data
*/
@Builder
@Value
public class DiscordPresence
{
/**
* The user's current party status.
* Example: "Looking to Play", "Playing Solo", "In a Group"
*
* <b>Maximum: 128 characters</b>
*/
private String state;
/**
* What the player is currently doing.
* Example: "Competitive - Captain's Mode", "In Queue", "Unranked PvP"
*
* <b>Maximum: 128 characters</b>
*/
private String details;
/**
* Unix timestamp (seconds) for the start of the game.
*/
private Instant startTimestamp;
/**
* Unix timestamp (seconds) for the start of the game.
*/
private Instant endTimestamp;
/**
* Name of the uploaded image for the large profile artwork.
* Example: "default"
*
* <b>Maximum: 32 characters</b>
*/
private String largeImageKey;
/**
* Tooltip for the largeImageKey.
* Example: "Blade's Edge Arena", "Numbani", "Danger Zone"
*
* <b>Maximum: 128 characters</b>
*/
private String largeImageText;
/**
* Name of the uploaded image for the small profile artwork.
* Example: "rogue"
*
* <b>Maximum: 32 characters</b>
*/
private String smallImageKey;
/**
* Tooltip for the smallImageKey.
* Example: "Rogue - Level 100"
*
* <b>Maximum: 128 characters</b>
*/
private String smallImageText;
/**
* ID of the player's party, lobby, or group.
* Example: "ae488379-351d-4a4f-ad32-2b9b01c91657"
*
* <b>Maximum: 128 characters</b>
*/
private String partyId;
/**
* Current size of the player's party, lobby, or group.
* Example: 1
*/
private int partySize;
/**
* Maximum size of the player's party, lobby, or group.
* Example: 5
*/
private int partyMax;
/**
* Unique hashed string for Spectate and Join.
* Required to enable match interactive buttons in the user's presence.
* Example: "MmhuZToxMjMxMjM6cWl3amR3MWlqZA=="
*
* <b>Maximum: 128 characters</b>
*/
private String matchSecret;
/**
* Unique hashed string for Spectate button.
* This will enable the "Spectate" button on the user's presence if whitelisted.
* Example: "MTIzNDV8MTIzNDV8MTMyNDU0"
*
* <b>Maximum: 128 characters</b>
*/
private String joinSecret;
/**
* Unique hashed string for chat invitations and Ask to Join.
* This will enable the "Ask to Join" button on the user's presence if whitelisted.
* Example: "MTI4NzM0OjFpMmhuZToxMjMxMjM="
*
* <b>Maximum: 128 characters</b>
*/
private String spectateSecret;
/**
* Marks the matchSecret as a game session with a specific beginning and end.
*/
private boolean instance;
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.discord;
/**
* Discord reply type for request
*/
public enum DiscordReplyType
{
/**
* Used to decline a request
*/
NO,
/**
* Used to accept a request
*/
YES,
/**
* Currently unused response, treated like NO.
*/
IGNORE
}

View File

@@ -0,0 +1,178 @@
/*
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.discord;
import com.google.common.base.Strings;
import com.google.common.eventbus.EventBus;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.RuneLiteProperties;
import net.runelite.client.discord.events.DiscordDisconnected;
import net.runelite.client.discord.events.DiscordErrored;
import net.runelite.client.discord.events.DiscordJoinGame;
import net.runelite.client.discord.events.DiscordJoinRequest;
import net.runelite.client.discord.events.DiscordReady;
import net.runelite.client.discord.events.DiscordSpectateGame;
import net.runelite.discord.DiscordEventHandlers;
import net.runelite.discord.DiscordRPC;
import net.runelite.discord.DiscordRichPresence;
@Singleton
@Slf4j
public class DiscordService implements AutoCloseable
{
@Inject
private EventBus eventBus;
@Inject
private RuneLiteProperties runeLiteProperties;
@Inject
private ScheduledExecutorService executorService;
private final DiscordEventHandlers discordEventHandlers = new DiscordEventHandlers();
private final DiscordRPC discordRPC = DiscordRPC.INSTANCE;
/**
* 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 {@link #close()}
*/
public void init()
{
log.info("Initializing Discord RPC service.");
discordEventHandlers.ready = this::ready;
discordEventHandlers.disconnected = this::disconnected;
discordEventHandlers.errored = this::errored;
discordEventHandlers.joinGame = this::joinGame;
discordEventHandlers.spectateGame = this::spectateGame;
discordEventHandlers.joinRequest = this::joinRequest;
discordRPC.Discord_Initialize(runeLiteProperties.getDiscordAppId(), discordEventHandlers, true, null);
executorService.scheduleAtFixedRate(discordRPC::Discord_RunCallbacks, 0, 2, TimeUnit.SECONDS);
}
/**
* Shuts the RPC connection down.
* If not currently connected, this does nothing.
*/
@Override
public void close()
{
discordRPC.Discord_Shutdown();
}
/**
* Updates the currently set presence of the logged in user.
* <br>Note that the client only updates its presence every <b>15 seconds</b>
* and queues all additional presence updates.
*
* @param discordPresence The new presence to use
*/
public void updatePresence(DiscordPresence discordPresence)
{
final DiscordRichPresence discordRichPresence = new DiscordRichPresence();
discordRichPresence.state = discordPresence.getState();
discordRichPresence.details = discordPresence.getDetails();
discordRichPresence.startTimestamp = discordPresence.getStartTimestamp() != null
? discordPresence.getStartTimestamp().getEpochSecond()
: 0;
discordRichPresence.endTimestamp = discordPresence.getEndTimestamp() != null
? discordPresence.getEndTimestamp().getEpochSecond()
: 0;
discordRichPresence.largeImageKey = Strings.isNullOrEmpty(discordPresence.getLargeImageKey())
? "default"
: discordPresence.getLargeImageKey();
discordRichPresence.largeImageText = discordPresence.getLargeImageText();
discordRichPresence.smallImageKey = Strings.isNullOrEmpty(discordPresence.getSmallImageKey())
? "default"
: discordPresence.getLargeImageKey();
discordRichPresence.smallImageText = discordPresence.getSmallImageText();
discordRichPresence.partyId = discordPresence.getPartyId();
discordRichPresence.partySize = discordPresence.getPartySize();
discordRichPresence.partyMax = discordPresence.getPartyMax();
discordRichPresence.matchSecret = discordPresence.getMatchSecret();
discordRichPresence.joinSecret = discordPresence.getJoinSecret();
discordRichPresence.spectateSecret = discordPresence.getSpectateSecret();
discordRichPresence.instance = (byte) (discordPresence.isInstance() ? 1 : 0);
discordRPC.Discord_UpdatePresence(discordRichPresence);
}
/**
* Clears the currently set presence.
*/
public void clearPresence()
{
discordRPC.Discord_ClearPresence();
}
/**
* Responds to the given user with the specified reply type.
*
* @param userId The id of the user to respond to
* @param reply The reply type
*/
public void respondToRequest(String userId, DiscordReplyType reply)
{
discordRPC.Discord_Respond(userId, reply.ordinal());
}
private void ready()
{
log.info("Discord RPC service is ready.");
eventBus.post(new DiscordReady());
}
private void disconnected(int errorCode, String message)
{
eventBus.post(new DiscordDisconnected(errorCode, message));
}
private void errored(int errorCode, String message)
{
eventBus.post(new DiscordErrored(errorCode, message));
}
private void joinGame(String joinSecret)
{
eventBus.post(new DiscordJoinGame(joinSecret));
}
private void spectateGame(String spectateSecret)
{
eventBus.post(new DiscordSpectateGame(spectateSecret));
}
private void joinRequest(net.runelite.discord.DiscordJoinRequest joinRequest)
{
eventBus.post(new DiscordJoinRequest(
joinRequest.userId,
joinRequest.username,
joinRequest.discriminator,
joinRequest.avatar));
}
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.discord.events;
import lombok.Value;
/**
* Called when the RPC connection has been severed
*/
@Value
public class DiscordDisconnected
{
/**
* Discord error code
*/
private int errorCode;
/**
* Error message
*/
private String message;
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.discord.events;
import lombok.Value;
/**
* Called when an internal error is caught within the SDK
*/
@Value
public class DiscordErrored
{
/**
* Discord error code.
*/
private int errorCode;
/**
* Error message
*/
private String message;
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.discord.events;
import lombok.Value;
/**
* Called when the logged in user joined a game
*/
@Value
public class DiscordJoinGame
{
/**
* Obfuscated data of your choosing used as join secret
*/
private String joinSecret;
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.discord.events;
import lombok.Value;
/**
* Called when another discord user wants to join the game of the logged in user
*/
@Value
public class DiscordJoinRequest
{
/**
* The userId for the user that requests to join
*/
private String userId;
/**
* The username of the user that requests to join
*/
private String username;
/**
* The discriminator of the user that requests to join
*/
private String discriminator;
/**
* The avatar of the user that requests to join
*/
private String avatar;
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.discord.events;
import lombok.Value;
/**
* Called when the RPC connection has been established
*/
@Value
public class DiscordReady
{
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.discord.events;
import lombok.Value;
/**
* Called when the logged in user joined to spectate a game
*/
@Value
public class DiscordSpectateGame
{
/**
* Obfuscated data of your choosing used as spectate secret
*/
private String spectateSecret;
}