Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading opus and sodium for voice #350

Open
IWasAllen opened this issue Jun 16, 2022 · 3 comments
Open

Loading opus and sodium for voice #350

IWasAllen opened this issue Jun 16, 2022 · 3 comments

Comments

@IWasAllen
Copy link

Every time I use the function channel:join(), it works perfectly fine as the bot joins the specific channel. However, I'm getting an output of libopus not found which make me worry. I already have the lib for opus and sodium and they're .so file extensions due to me being in Linux.

Using the voice document template, this is my current source code:

local discordia = require('discordia')
local client = discordia.Client()

client:on('ready', function()
    local channel = client:getChannel('975077088103116891')
    local connection = channel:join()
    connection:close()
end)

-- The rest are just the bot token logging in
@Bilal2453
Copy link
Contributor

Please for questions, ask in our Discord server or the DAPI server. Thank you.

@IWasAllen
Copy link
Author

IWasAllen commented Jun 17, 2022

Thanks for the understanding. I apologize for asking a question.

However, I found a way to fix this issue and I'll just leave it here just in case.
I putted the libopus.so file in the directory where main.lua.

At the main.lua, I required a library from the beginning of the line of code: local ffi = require('ffi'). I don't need to install the FFI library for my bot because Luvit already have it as an built-in package.


Then everything works now.
Source code:

-- main.lua
local ffi = require('ffi')
ffi.load('opus')
ffi.load('sodium')

local discordia = require('discordia')
local client = discordia.Client()

client:on('ready', function()
    local channel = client:getChannel('975077088103116891')
    local connection = channel:join()
    connection:close() -- This disconnects the bot from the vc
end)

client:run("Bot token")

File Directory:
Screenshot_1

If you're on linux, here's the opus dlls: libopus.zip

@Bilal2453
Copy link
Contributor

Bilal2453 commented Jun 17, 2022

Your solution is quite wrong. You are on Linux, you use your package manager. If you are on debian-based system it will be something like apt install libsqlite3-dev. You don't need to require the FFI library, you don't need to do anything related to the FFI library.

(Yes, that means you don't need the so file in your bot directory)

No one should distribute the so file because it won't work on all platforms, Linux has a package manager for a reason and it better be utilized.

I told you to ask in our server because it is much easier for me to just do ?tag sqlite which explains all of this instead of having to rewrite it again. It is also much easier for you to get help when it is instant messaging not a wait-an-entire-day-to-send-a-comment one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants