discord / gamesdk-and-dispatch

Public issue tracker for the Discord Game SDK and Dispatch
22 stars 7 forks source link

LobbyManager.ConnectVoice returns Results.Ok even when the user is not connected to the lobby #29

Open iTakeshi opened 4 years ago

iTakeshi commented 4 years ago

Describe the bug

I'm completely new to the game sdk and got confused with the behavior of LobbyManager.ConnectVoice Suppose I got a lobby struct by GetLobby, but I didn't call ConnectLobby. When I called ConnectVoice for this lobby, even though the current user is not connected to the lobby, the callback function for the ConnectVoice received Discord.Results.Ok (but seemed not "really" connected to the voice).

Steps to reproduce

pseudo-C# code is like:

lobbyManager.Search(search, (result) => {
    if (result == Discord.Result.Ok) {
        var lobbyId = lobbyManager.GetLobbyId(0);
        Console.WriteLine("existing lobby found: {0}", lobbyId);
        lobbyManager.ConnectVoice(lobbyId, (result) => {
            if (result == Discord.Result.Ok) {
                Console.WriteLine("voice connected");  // This always happens
            }
        });
    }
});

Expected behavior

I think it is more natural if ConnectVoice returns some error when the current user is not connected to the lobby.

Implementation specifics

Jump-Suit commented 4 years ago

First off, why are you trying to just lobby search? Your just searching and grabbing arbitrary data, the user has to input themselves a secret if they want to actually "connectlobby". ConnectVoice is returning ok since it is firing and receiving like it is supposed too, your just not actually IN a lobby...? Doesn't mean the callback itself failed, Ok just means it is working as intended firing to Discord -> Api and back.

iTakeshi commented 4 years ago

Sorry if my explanation was not completely clear, but just like I wrote it was a "pseudo" code, I was not trying to do exactly what the pseudo code looked like --- it is much simplified for "reproducing" the situation.

I know the pseudo-code itself contains a bug that (like you pointed out) it is attempting to ConncectVoice without ConnectLobby, but what I meant was that we (especially for beginners like me) CAN accidentally mistakenly write such code. In such cases, it would be helpful to detect the bug if ConnectVoice returns an error indicating "NotConnectedToLobby", instead of just returning Ok which only implies the API call itself was successful.

Jump-Suit commented 3 years ago

A simple fix for this could be to add a Result that states "NotConnectedToLobby" (Apologies for not responding to this issue sooner a year later now!) I don't think it would take that much work to add a new result for that.