SinisterRectus / Discordia

Discord API library written in Lua for the Luvit runtime environment
MIT License
712 stars 145 forks source link

Bot voice not working #393

Closed IUrixl closed 1 year ago

IUrixl commented 1 year ago

When i try to connect to a voiceChannel it returns nil.

Bilal2453 commented 1 year ago

Could you please provide more info? We can't really do much about this otherwise. What code are you using to replicate this issue? Do you have all the required libraries installed properly? What is the second return alongside the nil return? Or are there none?

IUrixl commented 1 year ago

Well, i have opus and sodium, the only message i get when trying to connect is

2023-06-23 18:29:48 | [WARNING] | Voice : Unhandled WebSocket payload OP 18
2023-06-23 18:29:48 | [WARNING] | Voice : Unhandled WebSocket payload OP 20

Im testing it with:

    local channel = client:getChannel("1119371664753438815")
    local connection = channel:join()

    while not connection do
        print("Reconnecting")
        connection = channel:join()
    end

But it wont return the connection, it will return "nil".

Bilal2453 commented 1 year ago

So connection is nil? What is the second return?

Do:

    local channel = client:getChannel("1119371664753438815")
    local connection, err = channel:join()

    while not connection do
            print("Connection Failed: ", err)
        print("Reconnecting")
        connection, err = channel:join()
    end
IUrixl commented 1 year ago

connection keeps being nil.

Now thanks to your code i can get the error on the cmd.

voice connection for channel 1119371664753438815 failed to initialize
IUrixl commented 1 year ago

Just found the solution! Disord has changed the response to 74 bytes, so i searched a solution for it and found the new file of "VoiceSocket" that's not in discordia 1.11.2

File

Bilal2453 commented 1 year ago

This has actually been merged already here https://github.com/SinisterRectus/Discordia/pull/377 ! It just hasn't been released on Lit yet. You can too just clone this Github repo again with git clone https://github.com/SinisterRectus/Discordia ./deps/discordia (after deleting the discordia folder, although keep the .dll files around) and you should be good as well.