【问题标题】:Discord.NET - Bot immediately disconnects after joining voice channelDiscord.NET - 机器人在加入语音频道后立即断开连接
【发布时间】:2018-09-10 09:06:24
【问题描述】:

我拥有所有库(libopus.dll 和 libsodium.dll),我的执行路径中有 FFMPEG 和一个音频文件,但机器人在加入频道后仍会立即断开连接。为什么会发生这种情况,我该如何解决?

编辑:我将此示例用于音频:https://gist.github.com/Joe4evr/773d3ce6cc10dbea6924d59bbfa3c62a

【问题讨论】:

  • 您能提供您用于该命令的代码吗?

标签: discord discord.net


【解决方案1】:

对于初学者,Foxbot 已准备好用于 Windows 的 libsodium 和 opus 库。这些也是我在个人音频机器人中使用的。

现在,根据您正在做的事情,您必须在哪里找到您的 dll 之间存在细微差别。

在部署运行期间,即发布的项目或直接通过您的bin/insert path to env etc 从控制台运行它,discord.net 在您的bin/insert path to env etc 中查找 libsodium/opus dll。

但是,在使用 Visual Studio 等工具运行调试期间,它不会查看您的 bin/insert path to env etc,而是查看项目的根文件夹。因此,对于这种情况,您还需要在 .csproj 所在的文件夹中包含 libsodium 和 opus dll。

作为个人喜好,我也对 ffmpeg.exe 做同样的事情。将其包括在部署的 bin 文件夹中,并在 csproj 之外有一个副本。

【讨论】:

  • 天哪,这帮了大忙。我不知道如果没有 Visual Studio 根文件夹提示我会做什么。非常感谢!
【解决方案2】:

这些是我从官方 Discord API 公会中提取的一些内容。

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

其他操作系统:

D.NET 用户注意:使用前需要将 libopus.dll 重命名为 opus.dll,否则音频客户端仍然会报错库。

【讨论】:

  • 我已经看过一百万次了,并且多次运行它,没有结果。
【解决方案3】:

使用 Discord.Net,您必须将 libopus.dll 重命名为 opus.dll

【讨论】:

  • 这没有改变。
猜你喜欢
  • 2020-05-24
  • 1970-01-01
  • 2021-12-16
  • 1970-01-01
  • 2021-11-19
  • 2023-02-25
  • 1970-01-01
  • 2021-11-21
  • 2020-07-16
相关资源
最近更新 更多