1

如标题中所述,我似乎无法让我的机器人加入我不和谐的语音频道。该命令的代码:

_commands.CreateCommand("join")
                .Description("Makes the bot join the first or default voice channel.")
                .Do(async (e) =>
                {
                    await e.Channel.SendIsTyping();
                    var voiceChannel = _client.FindServers("mealroom V2").FirstOrDefault().VoiceChannels.FirstOrDefault(); // Finds the first VoiceChannel on the server 'Music Bot Server'

                    var _vClient = await _client.GetService<AudioService>() // We use GetService to find the AudioService that we installed earlier. In previous versions, this was equivelent to _client.Audio()
                            .Join(VoiceChannel); // Join the Voice Channel, and return the IAudioClient.
                });

我正在使用 discord.Net 0.9.6。

任何帮助将不胜感激,谢谢!

PS我有Iaudio代码:

        _client.UsingAudio(x =>
        {
            x.Mode = AudioMode.Outgoing;
        });
4

2 回答 2

2

因为编写代码作为注释看起来不太好,而且你在 try catch 时遇到的麻烦:

try
{
    //your code here
}
catch(Exception exception)
{
    //error handling or breakpoint to check the exception
}
于 2017-03-10T10:56:19.977 回答
1

您需要拥有最新的 libsodium.dll 和 opus.dll 才能让机器人加入频道,否则机器人将无法连接到语音频道。我有一个与你的命令完全不同的命令,它工作正常,如果我要删除这两个,或者可能让它们过时,机器人将不会加入。

于 2017-03-27T16:54:24.627 回答