diff --git a/src/discord/core.cpp b/src/discord/core.cpp index 2427367b..c0b86a23 100644 --- a/src/discord/core.cpp +++ b/src/discord/core.cpp @@ -94,6 +94,13 @@ void DiscordInstance::after_ready() { spdlog::error("Current Connected User Error: {}", result.ToString()); } ); + + auto result = m_client.RegisterLaunchCommand( + constants::discord::application_id, constants::discord::platform_dependent_launch_arguments + ); + if (not result) { + spdlog::warn("Discord: Failed to Register Launch Command"); + }; } diff --git a/src/discord/core.hpp b/src/discord/core.hpp index c440a4bd..016d22c2 100644 --- a/src/discord/core.hpp +++ b/src/discord/core.hpp @@ -24,6 +24,25 @@ namespace constants::discord { constexpr u64 application_id = 1220147916371394650ULL; + +//TODO(Totto): this isn't correct for all platforms and needs to be tested +#if defined(__ANDROID__) +#error "Not supported" +#elif defined(__CONSOLE__) +#error "Not supported" +#elif defined(FLATPAK_BUILD) + constexpr const char* platform_dependent_launch_arguments = + "flatpak run io.github.openbrickprotocolfoundation.oopetris --discord"; +#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) + constexpr const char* platform_dependent_launch_arguments = "oopetris.exe --discord"; +#elif defined(__APPLE__) + constexpr const char* platform_dependent_launch_arguments = "TODO"; +#elif defined(__linux__) + constexpr const char* platform_dependent_launch_arguments = "oopetris --discord"; +#else +#error "Unsupported platform" +#endif + #if defined(__ANDROID__) constexpr const discordpp::ActivityGamePlatforms supported_platforms = discordpp::ActivityGamePlatforms::Android; #elif defined(__CONSOLE__)