cronokirby / alchemy

A discord library for Elixir
MIT License
152 stars 34 forks source link

Joining a voice channel does not work whatsoever anymore. #87

Closed dongmaster closed 4 years ago

dongmaster commented 4 years ago

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.

dongmaster commented 4 years ago

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: https://github.com/cronokirby/alchemy/blob/8d0fa7321989c2b60b684fd4918a9fbacabeaea7/lib/Voice/gateway.ex#L102 https://github.com/cronokirby/alchemy/blob/8d0fa7321989c2b60b684fd4918a9fbacabeaea7/lib/Voice/gateway.ex#L122

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

dongmaster commented 4 years ago

I did some more digging, and found out that this is where the library gets stuck, when trying to connect to the voice server: https://github.com/cronokirby/alchemy/blob/8d0fa7321989c2b60b684fd4918a9fbacabeaea7/lib/Voice/udp.ex#L10

@cronokirby Any ideas on how this can be fixed?

dongmaster commented 4 years ago

I made a pull request to this #88