From f4ced55d15abff3ad019c9e69811d7be0856b9a7 Mon Sep 17 00:00:00 2001 From: runebaas Date: Wed, 4 Apr 2018 01:41:37 +0200 Subject: [PATCH] Disable voice features --- Geekbot.net/Commands/Voice.cs | 204 +++++++++++++++++----------------- 1 file changed, 102 insertions(+), 102 deletions(-) diff --git a/Geekbot.net/Commands/Voice.cs b/Geekbot.net/Commands/Voice.cs index cda1f8b..ca65913 100644 --- a/Geekbot.net/Commands/Voice.cs +++ b/Geekbot.net/Commands/Voice.cs @@ -1,102 +1,102 @@ -using System; -using System.IO; -using System.Threading.Tasks; -using Discord; -using Discord.Commands; -using Geekbot.net.Lib; - -namespace Geekbot.net.Commands -{ - public class Voice : ModuleBase - { - private readonly IAudioUtils _audioUtils; - private readonly IErrorHandler _errorHandler; - - public Voice(IErrorHandler errorHandler, IAudioUtils audioUtils) - { - _errorHandler = errorHandler; - _audioUtils = audioUtils; - } - - [Command("join")] - public async Task JoinChannel() - { - try - { - // Get the audio channel - var channel = (Context.User as IGuildUser)?.VoiceChannel; - if (channel == null) - { - await Context.Channel.SendMessageAsync( - "User must be in a voice channel, or a voice channel must be passed as an argument."); - return; - } - - // For the next step with transmitting audio, you would want to pass this Audio Client in to a service. - var audioClient = await channel.ConnectAsync(); - _audioUtils.StoreAudioClient(Context.Guild.Id, audioClient); - await ReplyAsync($"Connected to {channel.Name}"); - } - catch (Exception e) - { - _errorHandler.HandleCommandException(e, Context); - } - } - - [Command("disconnect")] - public async Task DisconnectChannel() - { - try - { - var audioClient = _audioUtils.GetAudioClient(Context.Guild.Id); - if (audioClient == null) - { - await Context.Channel.SendMessageAsync("I'm not in a voice channel at the moment"); - return; - } - - await audioClient.StopAsync(); - await ReplyAsync("Disconnected from channel!"); - _audioUtils.Cleanup(Context.Guild.Id); - } - catch (Exception e) - { - _errorHandler.HandleCommandException(e, Context); - _audioUtils.Cleanup(Context.Guild.Id); - } - } - - [Command("ytplay")] - public async Task ytplay(string url) - { - try - { - if (!url.Contains("youtube")) - { - await ReplyAsync("I can only play youtube videos"); - return; - } - var audioClient = _audioUtils.GetAudioClient(Context.Guild.Id); - if (audioClient == null) - { - await ReplyAsync("I'm not in a voice channel at the moment"); - return; - } - - var message = await Context.Channel.SendMessageAsync("Just a second, i'm still a bit slow at this"); - var ffmpeg = _audioUtils.CreateStreamFromYoutube(url, Context.Guild.Id); - var output = ffmpeg.StandardOutput.BaseStream; - await message.ModifyAsync(msg => msg.Content = "**Playing!** Please note that this feature is experimental"); - var discord = audioClient.CreatePCMStream(Discord.Audio.AudioApplication.Mixed); - await output.CopyToAsync(discord); - await discord.FlushAsync(); - _audioUtils.Cleanup(Context.Guild.Id); - } - catch (Exception e) - { - _errorHandler.HandleCommandException(e, Context); - _audioUtils.Cleanup(Context.Guild.Id); - } - } - } -} \ No newline at end of file +//using System; +//using System.IO; +//using System.Threading.Tasks; +//using Discord; +//using Discord.Commands; +//using Geekbot.net.Lib; +// +//namespace Geekbot.net.Commands +//{ +// public class Voice : ModuleBase +// { +// private readonly IAudioUtils _audioUtils; +// private readonly IErrorHandler _errorHandler; +// +// public Voice(IErrorHandler errorHandler, IAudioUtils audioUtils) +// { +// _errorHandler = errorHandler; +// _audioUtils = audioUtils; +// } +// +// [Command("join")] +// public async Task JoinChannel() +// { +// try +// { +// // Get the audio channel +// var channel = (Context.User as IGuildUser)?.VoiceChannel; +// if (channel == null) +// { +// await Context.Channel.SendMessageAsync( +// "User must be in a voice channel, or a voice channel must be passed as an argument."); +// return; +// } +// +// // For the next step with transmitting audio, you would want to pass this Audio Client in to a service. +// var audioClient = await channel.ConnectAsync(); +// _audioUtils.StoreAudioClient(Context.Guild.Id, audioClient); +// await ReplyAsync($"Connected to {channel.Name}"); +// } +// catch (Exception e) +// { +// _errorHandler.HandleCommandException(e, Context); +// } +// } +// +// [Command("disconnect")] +// public async Task DisconnectChannel() +// { +// try +// { +// var audioClient = _audioUtils.GetAudioClient(Context.Guild.Id); +// if (audioClient == null) +// { +// await Context.Channel.SendMessageAsync("I'm not in a voice channel at the moment"); +// return; +// } +// +// await audioClient.StopAsync(); +// await ReplyAsync("Disconnected from channel!"); +// _audioUtils.Cleanup(Context.Guild.Id); +// } +// catch (Exception e) +// { +// _errorHandler.HandleCommandException(e, Context); +// _audioUtils.Cleanup(Context.Guild.Id); +// } +// } +// +// [Command("ytplay")] +// public async Task ytplay(string url) +// { +// try +// { +// if (!url.Contains("youtube")) +// { +// await ReplyAsync("I can only play youtube videos"); +// return; +// } +// var audioClient = _audioUtils.GetAudioClient(Context.Guild.Id); +// if (audioClient == null) +// { +// await ReplyAsync("I'm not in a voice channel at the moment"); +// return; +// } +// +// var message = await Context.Channel.SendMessageAsync("Just a second, i'm still a bit slow at this"); +// var ffmpeg = _audioUtils.CreateStreamFromYoutube(url, Context.Guild.Id); +// var output = ffmpeg.StandardOutput.BaseStream; +// await message.ModifyAsync(msg => msg.Content = "**Playing!** Please note that this feature is experimental"); +// var discord = audioClient.CreatePCMStream(Discord.Audio.AudioApplication.Mixed); +// await output.CopyToAsync(discord); +// await discord.FlushAsync(); +// _audioUtils.Cleanup(Context.Guild.Id); +// } +// catch (Exception e) +// { +// _errorHandler.HandleCommandException(e, Context); +// _audioUtils.Cleanup(Context.Guild.Id); +// } +// } +// } +//} \ No newline at end of file