How do I fix the error message "Unable to load DLL 'libopus'" when my Discord Bot (C#) joins a Voice Channel

0

I'm learning how to use the Dsharp library. I initialized the Voice Next client in my configuration class and now I want to test join and leave voice channel before I start working on playing audio.

When I use the 'join' command, the bot joins the voice channel I am currently in but I get this error message on the console:

"Unable to load DLL 'libopus': The specified module could not be found. (Exception from HRESULT: 0x8007007E) Connected to 'Voice Channel'"

...and it won't leave the channel when I use the 'leave' command, forcing me to manually disconnect it.

I assumed that I needed to find the dll library 'libopus' and include it in my project to fix this issue. But I'm not to sure on where to find it and how to include it. I've already searched a few GitHub repos that has a similar issue and I tried using the files from here to no avail. In addition, I followed the documentation to the best of my ability and the problem isn't solved.

[Command("join")]
        public async Task TestJoin(CommandContext ctx)
        {
            var vnext = ctx.Client.GetVoiceNextClient();

            var vnc = vnext.GetConnection(ctx.Guild);
            if (vnc != null)
            {
                await ctx.RespondAsync("You are already in a voice chat");
                return;
            }

            var vstat = ctx.Member?.VoiceState;
            DiscordChannel chnl = vstat.Channel;
            if (vstat?.Channel == null && chnl == null)
            {
                await ctx.RespondAsync("Join a voice channel.");
                return;
            }

            try
            {
                vnc = await vnext.ConnectAsync(chnl); //this line is causing problems 
            }
            catch(DllNotFoundException e)
            {
                await ctx.RespondAsync(e.Message); 
            }

            await ctx.RespondAsync($"Connected to `{chnl.Name}`"); //this line is not outputted to the text channel where the command is used
        }

There could be something I'm missing or instructions I'm overlooking. But right now, I'm stumped over this.

c#
audio
console-application
discord
dsharp+
asked on Stack Overflow Jan 20, 2020 by Uchenna Onuigbo

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0