From 990bb9b1efb341cc8aea15a0e4288916a284fd4d Mon Sep 17 00:00:00 2001 From: dobrykafe Date: Tue, 2 Apr 2024 23:57:17 +0200 Subject: [PATCH] show discord activity when offline --- src/engine/client/discord.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/engine/client/discord.cpp b/src/engine/client/discord.cpp index bb9dc7b4c..e7c400f87 100644 --- a/src/engine/client/discord.cpp +++ b/src/engine/client/discord.cpp @@ -55,6 +55,7 @@ public: } m_pActivityManager = m_pCore->get_activity_manager(m_pCore); + ClearGameInfo(); return false; } void Update() override @@ -63,7 +64,13 @@ public: } void ClearGameInfo() override { - m_pActivityManager->clear_activity(m_pActivityManager, 0, 0); + DiscordActivity Activity; + mem_zero(&Activity, sizeof(DiscordActivity)); + str_copy(Activity.assets.large_image, "ddnet_logo", sizeof(Activity.assets.large_image)); + str_copy(Activity.assets.large_text, "DDNet logo", sizeof(Activity.assets.large_text)); + Activity.timestamps.start = time_timestamp(); + str_copy(Activity.details, "Offline", sizeof(Activity.details)); + m_pActivityManager->update_activity(m_pActivityManager, &Activity, 0, 0); } void SetGameInfo(const NETADDR &ServerAddr, const char *pMapName, bool AnnounceAddr) override { @@ -72,7 +79,8 @@ public: str_copy(Activity.assets.large_image, "ddnet_logo", sizeof(Activity.assets.large_image)); str_copy(Activity.assets.large_text, "DDNet logo", sizeof(Activity.assets.large_text)); Activity.timestamps.start = time_timestamp(); - str_copy(Activity.details, pMapName, sizeof(Activity.details)); + str_copy(Activity.details, "Online", sizeof(Activity.details)); + str_copy(Activity.state, pMapName, sizeof(Activity.state)); m_pActivityManager->update_activity(m_pActivityManager, &Activity, 0, 0); } };