coastline 0.0.4
Loading...
Searching...
No Matches
coastline::DiscordPresence Class Reference

Optional Discord Rich Presence through the local desktop client's IPC endpoint. More...

#include <discordpresence.h>

Public Member Functions

 DiscordPresence (std::string_view applicationId)
 Start asynchronous IPC when support is compiled in and an application ID is supplied.
 ~DiscordPresence ()
 Stop the worker and close IPC before returning.
 DiscordPresence (const DiscordPresence &)=delete
 Prevent duplicate ownership of an IPC session.
DiscordPresence & operator= (const DiscordPresence &)=delete
 Prevent replacement of an active IPC session.
void Update (std::string_view details, std::string_view state={})
 Publish the latest activity without waiting for Discord.

Detailed Description

Optional Discord Rich Presence through the local desktop client's IPC endpoint.

Constructor & Destructor Documentation

◆ DiscordPresence() [1/2]

coastline::DiscordPresence::DiscordPresence ( std::string_view applicationId)
explicit

Start asynchronous IPC when support is compiled in and an application ID is supplied.

Missing clients are retried without blocking game processing. Empty or invalid IDs disable communication. No remote network connection or Discord registration is performed.

Parameters
applicationIdNonzero unsigned 64-bit decimal Discord application ID without leading zeros, or empty to disable presence.

◆ ~DiscordPresence()

coastline::DiscordPresence::~DiscordPresence ( )

Stop the worker and close IPC before returning.

◆ DiscordPresence() [2/2]

coastline::DiscordPresence::DiscordPresence ( const DiscordPresence & )
delete

Prevent duplicate ownership of an IPC session.

Member Function Documentation

◆ operator=()

DiscordPresence & coastline::DiscordPresence::operator= ( const DiscordPresence & )
delete

Prevent replacement of an active IPC session.

◆ Update()

void coastline::DiscordPresence::Update ( std::string_view details,
std::string_view state = {} )

Publish the latest activity without waiting for Discord.

Repeated identical updates are ignored; pending changes are coalesced and rate-limited.

Parameters
detailsActivity description in UTF-8, limited to 128 bytes without splitting codepoints.
stateAdditional activity state in UTF-8, limited to 128 bytes, or empty.

The documentation for this class was generated from the following file: