cronokirby/alchemy

Joining a voice channel does not work whatsoever anymore.

Closed this issue · 3 comments

When using Alchemy.Voice.join("guild_id", "channel_id"), the bot visibly joins the voice channel, and you can see the message about it joining the gateway:
11:03:44.907 [debug] Voice Gateway for guild_id connected

However, after about 6 seconds, you can see in iex that the join function returns {:error, "Timed out"} which makes the bot unable to play any audio whatsoever, even if it is connected to the gateway.

I'm currently looking into the bug myself, and it seems like the Alchemy.Voice.Controller doesn't get started at all for the guild, even if a connection to the gateway is being made. I tried joining a voice channel in a guild and added an IO.inspect to these two places:

def dispatch(%{"op" => 4, "d" => payload}, state) do

def websocket_info({:start_controller, me}, _, state) do

Yet I did not see any messages coming from these two functions when I made my bot join a voice channel. Gonna investigate further.

I did some more digging, and found out that this is where the library gets stuck, when trying to connect to the voice server:

{:ok, discovery} = :gen_udp.recv(udp, 70)

@cronokirby Any ideas on how this can be fixed?

I made a pull request to this #88