本文整理汇总了C#中Discord.DiscordClient.UsingAudio方法的典型用法代码示例。如果您正苦于以下问题:C# DiscordClient.UsingAudio方法的具体用法?C# DiscordClient.UsingAudio怎么用?C# DiscordClient.UsingAudio使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Discord.DiscordClient
的用法示例。
在下文中一共展示了DiscordClient.UsingAudio方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Startup
internal static void Startup(DiscordClient c)
{
c.UsingAudio(x =>
{
x.Mode = AudioMode.Outgoing;
x.EnableEncryption = true;
});
Music.Load(c);
}
示例2: ShowDialog
public override async void ShowDialog()
{
LoginDialog dialog = new LoginDialog();
if (dialog.ShowDialog() == true)
{
_client = new DiscordClient();
_client.UsingAudio(x =>
{
x.Mode = AudioMode.Outgoing;
x.Bitrate = null;
x.Channels = 2;
});
await _client.Connect(dialog.Username, dialog.Password);
var voiceChannel = CurrentServer.VoiceChannels.FirstOrDefault(d => d.Name == "Bot Test");
_voiceClient = await _client.GetService<AudioService>()
.Join(voiceChannel);
}
}
示例3: Start
public void Start()
{
Console.WriteLine("Initializing...");
_client = new DiscordClient();
_client.UsingAudio(x => // Opens an AudioConfigBuilder so we can configure our AudioService
{ x.Mode = AudioMode.Outgoing; // Tells the AudioService that we will only be sending audio
});
// _vClient = _client.GetService<AudioService>();
_client.MessageReceived += async (s, e) =>
{
if (!e.Message.IsAuthor)
{
Console.WriteLine(e.Message.User.Name + "> " + e.Message.Text);
if (e.Message.Text.StartsWith("!!"))
{
string command = e.Message.Text.Replace("!!", "");
// if (command.Equals(""))
// {
// await e.Channel.SendMessage("I am Jukebot. Do !!info for more details.");
//
// }
string[] words = command.Split(' ');
switch (words[0])
{
case "info":
await
e.Channel.SendMessage(
"```diff\n!====== [Jukebot] ======!" +
"\nA shitty ass music bot made by Ratismal (stupid cat)" +
"\nIt plays music. lol what did u expect" +
"\n!== [Features] ==!" +
"\n+ a shitty looking unintuitive piece of shit GUI that only the host can see (lol)" +
"\n+ plays music" +
"\n!== [Commands] ==!" +
"\n+ !!info - shows this" +
"\n+ !!summon - summons bot to current voice channel" +
"\n+ !!banish - tells the bot to piss off" +
"\n+ !!volume - shows the current volume" +
"\n+ !!volume <amount> - set the volume" +
"\n+ !!volume +-<amount> - add/subtract the volume" +
"\n!== [Conclusi] ==!" +
"\n+ '-on' cut off from title for consistancy spacing sake" +
"\n+ fuck my life" +
"\n+ you want to play something? GOOD LUCK WITH THAT LOL ONLY I CAN" +
"\n- This is red text!" +
"\n- its really late i should go to bed lol fml smfh lmao kms" +
"\n```");
break;
case "summon":
Console.WriteLine("Joining a voice channel");
await e.Channel.SendMessage("Joining channel");
var voiceChannel = e.User.VoiceChannel;
_vClient = await _client.GetService<AudioService>().Join(voiceChannel);
//await _vClient.Join(voiceChannel);
break;
case "banish":
Console.WriteLine("Leaving a voice channel");
await e.Channel.SendMessage("Leaving channel");
await _client.GetService<AudioService>().Leave(e.Server);
break;
case "volume":
if (words.Length == 1)
{
e.Channel.SendMessage("Current volume: " + MainWindow.volume);
}
else
{
// string goodstuff;
if (words[1].StartsWith("+") || words[1].StartsWith("-"))
{
int addVolume = Int32.Parse(words[1]);
MainWindow.volume += addVolume;
e.Channel.SendMessage("New volume: " + MainWindow.volume);
}
else
{
MainWindow.volume = Int32.Parse(words[1]);
e.Channel.SendMessage("New volume: " + MainWindow.volume);
}
}
break;
default:
await e.Channel.SendMessage("I am Jukebot. Do !!info for more details.");
break;
}
}
}
};
_client.ExecuteAndWait(async () =>
{
await
_client.Connect(token
);
});
//.........这里部分代码省略.........