mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
show discord activity when offline
This commit is contained in:
parent
3eda861c37
commit
990bb9b1ef
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue