Discord Social SDK
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
discordpp::LobbyMemberHandle Class Reference

Detailed Description

A LobbyMemberHandle represents the state of a single user in a Lobby.

The SDK separates lobby membership into two concepts:

  1. Has the user been added to the lobby by the game developer? If the LobbyMemberHandle exists for a user/lobby pair, then the user has been added to the lobby.
  2. Does the user have an active game session that is connected to the lobby and will receive any lobby messages? It is possible for a game developer to add a user to a lobby while they are offline. Also users may temporarily disconnect and rejoin later. So the Connected boolean tells you whether the user is actively connected to the lobby.

Handle objects in the SDK hold a reference both to the underlying data, and to the SDK instance. Changes to the underlying data will generally be available on existing handles objects without having to re-create them. If the SDK instance is destroyed, but you still have a reference to a handle object, note that it will return the default value for all method calls (ie an empty string for methods that return a string).

Public Member Functions

 LobbyMemberHandle (LobbyMemberHandle &&other) noexcept
 Move constructor for LobbyMemberHandle.
 
LobbyMemberHandleoperator= (LobbyMemberHandle &&other) noexcept
 Move assignment operator for LobbyMemberHandle.
 
 operator bool () const
 Returns true if the instance contains a valid object.
 
 LobbyMemberHandle (const LobbyMemberHandle &other)
 Copy constructor for LobbyMemberHandle.
 
LobbyMemberHandleoperator= (const LobbyMemberHandle &other)
 Copy assignment operator for LobbyMemberHandle.
 
bool CanLinkLobby () const
 Returns true if the user is allowed to link a channel to this lobby.
 
bool Connected () const
 Returns true if the user is currently connected to the lobby.
 
uint64_t Id () const
 The user id of the lobby member.
 
std::unordered_map< std::string, std::string > Metadata () const
 Metadata is a set of string key/value pairs that the game developer can use.
 
std::optional< discordpp::UserHandleUser () const
 The UserHandle of the lobby member.
 

Static Public Attributes

static const LobbyMemberHandle nullobj
 Uninitialized instance of LobbyMemberHandle.
 

Constructor & Destructor Documentation

◆ LobbyMemberHandle() [1/2]

discordpp::LobbyMemberHandle::LobbyMemberHandle ( LobbyMemberHandle && other)
noexcept

Move constructor for LobbyMemberHandle.

◆ LobbyMemberHandle() [2/2]

discordpp::LobbyMemberHandle::LobbyMemberHandle ( const LobbyMemberHandle & other)

Copy constructor for LobbyMemberHandle.

Member Function Documentation

◆ CanLinkLobby()

bool discordpp::LobbyMemberHandle::CanLinkLobby ( ) const

Returns true if the user is allowed to link a channel to this lobby.

Under the hood this checks if the LobbyMemberFlags::CanLinkLobby flag is set. This flag can only be set via the server API, add_lobby_member The use case for this is for games that want to restrict a lobby so that only the clan/guild/group leader is allowed to manage the linked channel for the lobby.

◆ Connected()

bool discordpp::LobbyMemberHandle::Connected ( ) const

Returns true if the user is currently connected to the lobby.

◆ Id()

uint64_t discordpp::LobbyMemberHandle::Id ( ) const

The user id of the lobby member.

◆ Metadata()

std::unordered_map< std::string, std::string > discordpp::LobbyMemberHandle::Metadata ( ) const

Metadata is a set of string key/value pairs that the game developer can use.

A common use case may be to store the game's internal user ID for this user so that every member of a lobby knows the discord user ID and the game's internal user ID mapping for each user.

◆ operator bool()

discordpp::LobbyMemberHandle::operator bool ( ) const
inline

Returns true if the instance contains a valid object.

◆ operator=() [1/2]

LobbyMemberHandle & discordpp::LobbyMemberHandle::operator= ( const LobbyMemberHandle & other)

Copy assignment operator for LobbyMemberHandle.

◆ operator=() [2/2]

LobbyMemberHandle & discordpp::LobbyMemberHandle::operator= ( LobbyMemberHandle && other)
noexcept

Move assignment operator for LobbyMemberHandle.

◆ User()

std::optional< discordpp::UserHandle > discordpp::LobbyMemberHandle::User ( ) const

The UserHandle of the lobby member.

Member Data Documentation

◆ nullobj

const LobbyMemberHandle discordpp::LobbyMemberHandle::nullobj
static

Uninitialized instance of LobbyMemberHandle.