Skip to content

Commit 7045e48

Browse files
authored
Merge pull request #221 from OpenBrickProtocolFoundation/add_missing_discord_functionality
fix: add back removed feature when migrating the discord SDK
2 parents a24cf50 + 78abc9f commit 7045e48

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/discord/core.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,13 @@ void DiscordInstance::after_ready() {
9494
spdlog::error("Current Connected User Error: {}", result.ToString());
9595
}
9696
);
97+
98+
auto result = m_client.RegisterLaunchCommand(
99+
constants::discord::application_id, constants::discord::platform_dependent_launch_arguments
100+
);
101+
if (not result) {
102+
spdlog::warn("Discord: Failed to Register Launch Command");
103+
};
97104
}
98105

99106

src/discord/core.hpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@
2424
namespace constants::discord {
2525
constexpr u64 application_id = 1220147916371394650ULL;
2626

27+
28+
//TODO(Totto): this isn't correct for all platforms and needs to be tested
29+
#if defined(__ANDROID__)
30+
#error "Not supported"
31+
#elif defined(__CONSOLE__)
32+
#error "Not supported"
33+
#elif defined(FLATPAK_BUILD)
34+
constexpr const char* platform_dependent_launch_arguments =
35+
"flatpak run io.github.openbrickprotocolfoundation.oopetris --discord";
36+
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
37+
constexpr const char* platform_dependent_launch_arguments = "oopetris.exe --discord";
38+
#elif defined(__APPLE__)
39+
constexpr const char* platform_dependent_launch_arguments = "TODO";
40+
#elif defined(__linux__)
41+
constexpr const char* platform_dependent_launch_arguments = "oopetris --discord";
42+
#else
43+
#error "Unsupported platform"
44+
#endif
45+
2746
#if defined(__ANDROID__)
2847
constexpr const discordpp::ActivityGamePlatforms supported_platforms = discordpp::ActivityGamePlatforms::Android;
2948
#elif defined(__CONSOLE__)

0 commit comments

Comments
 (0)