Discord.NET - Bot immediately disconnects after joining voice channel

依然范特西╮ 提交于 2019-12-02 09:03:13

问题


I have all of the libraries (libopus.dll and libsodium.dll), I have FFMPEG and an audio file in my execution path, but still the bot immediately disconnects after joining the channel. Why is this happening and how do I fix it?

EDIT: I use this sample for audio: https://gist.github.com/Joe4evr/773d3ce6cc10dbea6924d59bbfa3c62a


回答1:


These are a few things I pulled from the official Discord API guild.

Windows 64-bit: https://dsharpplus.emzi0767.com/natives/vnext_natives_win32_x64.zip
Windows 32-bit: https://dsharpplus.emzi0767.com/natives/vnext_natives_win32_x86.zip
FFmpeg for Windows: https://dsharpplus.emzi0767.com/natives/index.html#ffmpeg-for-windows

Other OSes:

  • GNU/Linux: https://dsharpplus.emzi0767.com/articles/vnext_setup.html#gnulinux-1

  • OS X: https://dsharpplus.emzi0767.com/articles/vnext_setup.html#mac-os-x-1

  • FreeBSD: https://dsharpplus.emzi0767.com/articles/vnext_setup.html#freebsd

Note for D.NET users: You need to rename libopus.dll to opus.dll before use, otherwise audio client will still complain about missing libraries.




回答2:


With Discord.Net you have to rename libopus.dll to opus.dll.




回答3:


For starters, Foxbot has the libsodium and opus libraries for windows ready to go. These are the ones I use in my personal audio bot as well.

Now, there is a slight difference between where you have to locate your dll's based on what you are doing.

During deployed runs, aka published project or running it from the console through your bin/insert path to env etc directly, discord.net looks for the libsodium/opus dll's in your bin/insert path to env etc.

However, during debug runs with visual studio and the likes, instead of looking in your bin/insert path to env etc, it will look in the root folder of your project. Hence for this scenario, you will also need to include the libsodium and opus dll's in the folder where your .csproj is located.

As a personal preference, I also do the same for the ffmpeg.exe. Including this both in deployed bin folders, and having a copy besides the csproj.



来源:https://stackoverflow.com/questions/49589407/discord-net-bot-immediately-disconnects-after-joining-voice-channel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!