From 9f9c87c7727361128e33f68fb7af9687ce85c0c1 Mon Sep 17 00:00:00 2001 From: Zarutian Date: Thu, 10 Oct 2024 01:11:20 +0000 Subject: [PATCH 1/3] Adding a missing friends.getRichPresence function see https://partner.steamgames.com/doc/api/ISteamFriends#GetFriendRichPresenceluasteam_getRichPresence for Steam SDK docu. A few commits starting with a . is conceptually part of this commit. --- src/friends.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/friends.cpp b/src/friends.cpp index 9754d35..7a29a14 100644 --- a/src/friends.cpp +++ b/src/friends.cpp @@ -96,6 +96,15 @@ EXTERN int luasteam_setRichPresence(lua_State *L) { return 1; } +// const char * GetFriendRichPresence( CSteamID steamIDFriend, const char *pchKey ); +EXTERN int luasteam_getRichPresence(lua_State *L) { + CSteamID id(luasteam::checkuint64(L, 1)); + const char *key = luaL_checkstring(L, 2); + const char *value = SteamFriends()->GetFriendRichPresence(id, key); + lua_pushstring(L, value); + return 1; +} + // bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString ); EXTERN int luasteam_inviteUserToGame(lua_State *L) { CSteamID id(luasteam::checkuint64(L, 1)); @@ -133,6 +142,7 @@ void add_friends(lua_State *L) { add_func(L, "activateGameOverlayToWebPage", luasteam_activateGameOverlayToWebPage); add_func(L, "getFriendPersonaName", luasteam_getFriendPersonaName); add_func(L, "setRichPresence", luasteam_setRichPresence); + add_func(L, "getRichPresence", luasteam_getRichPresence); add_func(L, "inviteUserToGame", luasteam_inviteUserToGame); add_func(L, "getFriendCount", luasteam_getFriendCount); add_func(L, "getFriendByIndex", luasteam_getFriendByIndex); From a3fc9c7f2b7f4a1062218560d3ab2fa384039567 Mon Sep 17 00:00:00 2001 From: Zarutian Date: Thu, 10 Oct 2024 01:29:26 +0000 Subject: [PATCH 2/3] . adding docu for friends.getRichPresence --- docs/friends.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/friends.rst b/docs/friends.rst index 5de4cf7..771be00 100644 --- a/docs/friends.rst +++ b/docs/friends.rst @@ -9,6 +9,7 @@ List of Functions * :func:`friends.activateGameOverlayToWebPage` * :func:`friends.getFriendPersonaName` * :func:`friends.setRichPresence` +* :func:`friends.getRichPresence` * :func:`friends.inviteUserToGame` * :func:`friends.getFriendCount` * :func:`friends.getFriendByIndex` @@ -111,6 +112,15 @@ Function Reference } } +.. function:: +friends.getRichPresence(steamIDFriend, key) + :param uint64 steamIDFriend: The Steam ID of the friend to get rich presence of. + :param string key: The rich presence key to set. Maximum length is 64 characters. + :returns: (`string`) The value associated with the rich presence key. Maximum length is 256 characters. If this is ``''`` then the key has been removed or does not exists. + :SteamWorks: `GetRichPresence `_ + +**Example**:: + .. function:: friends.inviteUserToGame(steamIDFriend, connect_string) :param uint64 steamIDFriend: The Steam ID of the friend to invite. From a563902186bb61802060e0aba5fefed5c61f767f Mon Sep 17 00:00:00 2001 From: Zarutian Date: Thu, 10 Oct 2024 01:36:18 +0000 Subject: [PATCH 3/3] . adding an example for friends.getRichPresence() --- docs/friends.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/friends.rst b/docs/friends.rst index 771be00..48db5dc 100644 --- a/docs/friends.rst +++ b/docs/friends.rst @@ -120,6 +120,8 @@ friends.getRichPresence(steamIDFriend, key) :SteamWorks: `GetRichPresence `_ **Example**:: + steam_id = getSteamIdSomehow() + print("Friend's text status is:", Steam.friends.getRichPresence(steam_id, "text")) .. function:: friends.inviteUserToGame(steamIDFriend, connect_string)