You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

joining_audio.cs 634 B

123456789101112131415
  1. // Create an IAudioClient, and store it for later use
  2. private IAudioClient _audio;
  3. // Create a Join command, that will join the parameter or the user's current voice channel
  4. [Command("join")]
  5. public async Task JoinChannel(IUserMessage msg,
  6. IVoiceChannel channel = null)
  7. {
  8. // Get the audio channel
  9. channel = channel ?? (msg.Author as IGuildUser)?.VoiceChannel;
  10. if (channel == null) { await msg.Channel.SendMessageAsync("User must be in a voice channel, or a voice channel must be passed as an argument."); return; }
  11. // Get the IAudioClient by calling the JoinAsync method
  12. _audio = await channel.JoinAsync();
  13. }