Skip to content

Fix Social SDK leaving lobby #7540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

thiagola92
Copy link
Contributor

In the section Managing Lobbies, the code for Leaving a Lobby:

// Leaving a lobby from the client
client->LeaveLobby(01234567890, [](discordpp::ClientResult result, uint64_t lobbyId) {
  if(result.Successful()) {
    std::cout << "🎮 Left lobby successfully! Lobby Id: " << lobbyId << std::endl;
  } else {
    std::cerr << "❌ Leaving lobby failed\n";
  }
}

Mention a uint64_t lobbyId which doesn't seem to exist in LeaveLobbyCallback.

I was thinking in changing the example to:

// Leaving a lobby from the client
client->LeaveLobby(01234567890, [](discordpp::ClientResult result) {
  if(result.Successful()) {
    std::cout << "🎮 Left lobby successfully! Lobby Id: 01234567890\n";
  } else {
    std::cerr << "❌ Leaving lobby failed\n";
  }
}

@thiagola92 thiagola92 requested a review from a team as a code owner May 5, 2025 06:16
@thiagola92 thiagola92 requested review from colinloretz and removed request for a team May 5, 2025 06:16
@markmandel
Copy link
Contributor

Totally off the top of my head:

// Leaving a lobby from the client
uint64_t lobbyId = 01234567890;
client->LeaveLobby(lobbyId, [&](discordpp::ClientResult result) {
  if(result.Successful()) {
    std::cout << "🎮 Left lobby successfully! Lobby Id: " << lobbyId << std::endl;
  } else {
    std::cerr << "❌ Leaving lobby failed\n";
  }
}

But I think that will work, and you can see it get passed through? WDYT?

@thiagola92
Copy link
Contributor Author

I like it.

In this case, I could also change the example from Sending Messages to a Lobby to match it:

uint64_t lobbyId = 01234567890;

client->SendLobbyMessage(lobbyId, "Hello", [](discordpp::ClientResult result, uint64_t messageId) {
  if(result.Successful()) {
    std::cout << "📨 Message sent successfully!\n";
  } else {
    std::cerr << "❌ Message sending failed\n";
  }
});

Note: can I also add a space between creating variable and the function calling?

@markmandel
Copy link
Contributor

Sure - that works for me 👍🏻 sounds good!

No concerns on extra line break 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants