SinisterRectus / Discordia

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

guildVoiceChannel:leave() does not kick the bot. #277

Closed HappleMan closed 3 years ago

HappleMan commented 3 years ago

I'm pretty new to Discordia, but after joining a bot to a player's voice chat, I can't seem to disconnect it via the code. I'm not getting any errors related to the code that I wrote. Here are the errors I am getting: ` [C]: in function 'assert' C:/Users/me/Discord Bot/deps/coro-channel.lua:62: in function 'onPlain' C:/Users/me/Discord Bot/deps/secure-socket/biowrap.lua:76: in function <C:/Users/me/Discord Bot/deps/secure-socket/biowrap.lua:61> [C]: in function 'run'

    [C]: in function 'xpcall'
    [string "bundle:/init.lua"]:47: in function 'fn'
    [string "bundle:deps/require.lua"]:310: in function <[string "bundle:deps/require.lua"]:266>`

None of these seem to be coming from bot.lua, my main code. IIs anyone experiencing this and is there a way to fix it? Thanks!

HappleMan commented 3 years ago

I forgot to mention, I do get a message whenever I the bot joins a channel about not being able to find libopus. Could this be causing the issue?

EngrShahria commented 3 years ago

Do you have the audio runtime files in the main directory? Also, you are just showing the error lone but not the code. If you cannot share the code, where the code is causing trouble, we cannot help.

HappleMan commented 3 years ago

Hey, sorry about that. I don't have any audio runtime files, how can I download them? Also, here is the block that keeps breaking: for i,v in pairs(message.guild.voiceChannels) do for o,b in pairs(v.connectedMembers) do if b.name == message.author.name then voicechan = false print("leaving "..v.name) v:leave() end end end This is almost the exact same as the block that joins the call, only I can't seem to get it to leave.

EngrShahria commented 3 years ago

Read https://github.com/SinisterRectus/Discordia/wiki/VoiceConnection It should be :close()

SinisterRectus commented 3 years ago

Are you still having a problem here?

HappleMan commented 3 years ago

Yeah, I never figured out how to install opus and sodium. I have the files downloaded, but I can't seem to get them to work in the code.

SinisterRectus commented 3 years ago

There is a readme at https://github.com/SinisterRectus/Discordia/tree/master/bin. If you're still having trouble, join us at https://discord.gg/NKM3XmF or https://discord.gg/EzRYYDW.