【发布时间】:2017-07-31 16:02:36
【问题描述】:
如标题中所述,我似乎无法让我的机器人加入我不和谐的语音频道。 命令代码:
_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。
任何帮助将不胜感激,谢谢!
P.S 我有 Iaudio 代码:
_client.UsingAudio(x =>
{
x.Mode = AudioMode.Outgoing;
});
【问题讨论】:
-
您遇到错误了吗?您是否尝试过将代码放在 try catch 子句中以查看是否有异常以获取更多详细信息?
-
没有错误,机器人运行得很好,只是没有连接到 vc。我会试试你说的
-
我试图做一个 try catch 子句,但我对 C# 很陌生,而且很累,我无法让它工作。 try{ 的结束括号始终连接到 MyBot 类 {
-
看看我的回答。
-
异步错误处理不是很直观bartread.com/2014/02/13/…
标签: c# discord discord.net