Update discord state

This commit is contained in:
momo5502 2019-01-06 20:52:51 +01:00
parent 67fc5630f7
commit c3f7976ed3

View File

@ -2,12 +2,15 @@
#include <discord_rpc.h> #include <discord_rpc.h>
#include "loader/module_loader.hpp" #include "loader/module_loader.hpp"
#include "scheduler.hpp" #include "scheduler.hpp"
#include "game/game.hpp"
class discord final : public module class discord final : public module
{ {
public: public:
void post_load() override void post_load() override
{ {
if (game::is_dedi()) return;
DiscordEventHandlers handlers; DiscordEventHandlers handlers;
ZeroMemory(&handlers, sizeof(handlers)); ZeroMemory(&handlers, sizeof(handlers));
handlers.ready = ready; handlers.ready = ready;
@ -33,12 +36,12 @@ private:
DiscordRichPresence discord_presence; DiscordRichPresence discord_presence;
ZeroMemory(&discord_presence, sizeof(discord_presence)); ZeroMemory(&discord_presence, sizeof(discord_presence));
discord_presence.state = "Cake!"; discord_presence.state = game::is_mp() ? "Multiplayer" : "Singleplayer";
discord_presence.instance = 1; discord_presence.instance = 1;
Discord_UpdatePresence(&discord_presence); Discord_UpdatePresence(&discord_presence);
} }
static void errored(int error_code, const char* message) static void errored(const int error_code, const char* message)
{ {
printf("Discord: (%i) %s", error_code, message); printf("Discord: (%i) %s", error_code, message);
} }