From 2bb4f93e10793530596b959a850f42f863c46e79 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Thu, 11 Feb 2016 13:36:17 +0100 Subject: [PATCH] pushed this, but it doesn't do anything, just to prevent errors in forks --- .../Commands/VoiceNotificationCommand.cs | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 NadekoBot/Commands/VoiceNotificationCommand.cs diff --git a/NadekoBot/Commands/VoiceNotificationCommand.cs b/NadekoBot/Commands/VoiceNotificationCommand.cs new file mode 100644 index 00000000..b173a90d --- /dev/null +++ b/NadekoBot/Commands/VoiceNotificationCommand.cs @@ -0,0 +1,44 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using Discord.Commands; +using System.Collections.Concurrent; +using Discord; + +namespace NadekoBot.Commands { + class VoiceNotificationCommand : DiscordCommand { + + + public VoiceNotificationCommand() : base() { + //NadekoBot.client. + } + + //voicechannel/text channel + ConcurrentDictionary subscribers = new ConcurrentDictionary(); + + public override Func DoFunc() => async e => { + var arg = e.GetArg("voice_name"); + if (string.IsNullOrWhiteSpace("voice_name")) + return; + var voiceChannel = e.Server.FindChannels(arg, ChannelType.Voice).FirstOrDefault(); + if (voiceChannel == null) + return; + if (subscribers.ContainsKey(voiceChannel)) { + await e.Channel.SendMessage("`Voice channel notifications disabled.`"); + return; + } + if (subscribers.TryAdd(voiceChannel, e.Channel)) { + await e.Channel.SendMessage("`Voice channel notifications enabled.`"); + } + }; + + public override void Init(CommandGroupBuilder cgb) { + /* + cgb.CreateCommand(".voicenotif") + .Description("Enables notifications on who joined/left the voice channel.\n**Usage**:.voicenotif Karaoke club") + .Parameter("voice_name", ParameterType.Unparsed) + .Do(DoFunc()); + */ + } + } +}