Exemplo n.º 1
0
        /// <summary>
        /// Save current trigger to file
        /// </summary>
        public void SaveTrigger()
        {
            if (!Directory.Exists(Bot.username + "/triggers/"))
            {
                Directory.CreateDirectory(Bot.username + "/triggers/");
            }

            if (Options != null)
            {
                TriggerOptionsBase options = new TriggerOptionsBase
                {
                    Name                   = Options.Name,
                    Type                   = Options.Type,
                    ChatCommand            = Options.ChatCommand,
                    ChatCommandApi         = Options.ChatCommandApi,
                    ChatReply              = Options.ChatReply,
                    NoCommand              = Options.NoCommand,
                    TriggerLists           = Options.TriggerLists,
                    TriggerNumbers         = Options.TriggerNumbers,
                    AntiSpamTriggerOptions = Options.AntiSpamTriggerOptions,
                    DiscordOptions         = Options.DiscordOptions,
                    NoteTriggerOptions     = Options.NoteTriggerOptions,
                    NotificationOptions    = Options.NotificationOptions,
                    MessageIntervalOptions = Options.MessageIntervalOptions
                };
                string json = JsonConvert.SerializeObject(options, Formatting.Indented);
                File.WriteAllText(Bot.username + "/triggers/" + Name + ".json", json);
            }
            else if (Options == null)
            {
                TriggerOptionsBase options = new TriggerOptionsBase();
                string             json    = JsonConvert.SerializeObject(options, Formatting.Indented);
                File.WriteAllText(Bot.username + "/triggers/" + Name + ".json", json);
            }
        }
Exemplo n.º 2
0
        public AntispamTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
        {
            options.AntiSpamTriggerOptions.groups = new Dictionary <SteamID, Dictionary <SteamID, int> >();
            Timer reducePenT = new Timer(options.AntiSpamTriggerOptions.ptimer.resolution);

            reducePenT.Elapsed += ReducePenT_Tick;
            reducePenT.Start();
        }
Exemplo n.º 3
0
        public BaseTrigger(TriggerType type, string name, TriggerOptionsBase options)
        {
            if (options.AntiSpamTriggerOptions != null)
            {
                OptionsType = OptionType.AntiSpamTrigger;
            }
            else if (options.ChatCommand != null)
            {
                OptionsType = OptionType.ChatCommand;
            }
            else if (options.ChatCommandApi != null)
            {
                OptionsType = OptionType.ChatCommandAPI;
            }
            else if (options.ChatReply != null)
            {
                OptionsType = OptionType.ChatReply;
            }
            else if (options.DiscordOptions != null)
            {
                OptionsType = OptionType.DiscordTrigger;
            }
            else if (options.NoCommand != null)
            {
                OptionsType = OptionType.NoCommand;
            }
            else if (options.TriggerLists != null && options.TriggerNumbers != null)
            {
                OptionsType = OptionType.ListsAndNumbers;
            }
            else if (options.TriggerLists != null)
            {
                OptionsType = OptionType.JustLists;
            }
            else if (options.NoteTriggerOptions != null)
            {
                OptionsType = OptionType.NoteTriggerOptions;
            }
            else if (options.NotificationOptions != null)
            {
                OptionsType = OptionType.NotificationOptions;
            }

            Type    = type;
            Name    = name;
            Options = options;
        }
Exemplo n.º 4
0
        private async void chatbotsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            addedTriggersListBox.Items.Clear();
            if (e.AddedItems[0].ToString() != "" && e.AddedItems[0].ToString() != null)
            {
                Bot.userDir = await Bot.folder.GetFolderAsync(e.AddedItems[0].ToString());

                Bot.triggerDir = await Bot.userDir.GetFolderAsync("triggers");

                IReadOnlyList <StorageFile> files = await Bot.triggerDir.GetFilesAsync();

                foreach (StorageFile file in files)
                {
                    string text = await FileIO.ReadTextAsync(file);

                    TriggerOptionsBase options = JsonConvert.DeserializeObject <TriggerOptionsBase>(text);
                    addedTriggersListBox.Items.Add(options.Name + " - " + options.Type.ToString());
                    BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("Chaos.Triggers." + options.Type.ToString()), options.Type, options.Name, options);
                    Bot.Triggers.Add(trigger);
                }
            }
        }
 public AcceptChatInviteTrigger(TriggerType type, string name, TriggerOptionsBase tl) : base(type, name, tl)
 {
 }
 public PlayGameTrigger(TriggerType type, string name, TriggerOptionsBase cc) : base(type, name, cc)
 {
 }
Exemplo n.º 7
0
 public DoormatTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
 {
 }
Exemplo n.º 8
0
 public ChooseTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
 {
 }
Exemplo n.º 9
0
 public WeatherTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
 {
 }
Exemplo n.º 10
0
 public DiscordTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
 {
 }
Exemplo n.º 11
0
 public BaseTrigger(TriggerType type, string name, TriggerOptionsBase options)
 {
     Type    = type;
     Name    = name;
     Options = options;
 }
Exemplo n.º 12
0
 public MessageIntervalTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
 { }
Exemplo n.º 13
0
 public ModerateChatTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
 {
 }
Exemplo n.º 14
0
 public TranslateTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
 {
 }
Exemplo n.º 15
0
 public UnlockChatTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
 {
 }
Exemplo n.º 16
0
        /// <summary>
        /// Read triggers from username/triggers/
        /// </summary>
        /// <returns>A list of BaseTrigger objects</returns>
        public static List <BaseTrigger> ReadTriggers()
        {
            List <BaseTrigger>   temp  = new List <BaseTrigger>();
            IEnumerable <string> files = Directory.EnumerateFiles(Bot.username + "/triggers/");

            foreach (string file in files)
            {
                /*
                 * int start = file.IndexOf("triggers/") + "triggers/".Length;
                 * int end = file.IndexOf(".", start);
                 * string _file = file.Substring(start, end - start);
                 */

                TriggerOptionsBase options = JsonConvert.DeserializeObject <TriggerOptionsBase>(File.ReadAllText(file));
                TriggerType        type    = options.Type;
                string             name    = options.Name;

                switch (type)
                {
                case TriggerType.AcceptChatInviteTrigger:
                    temp.Add(new AcceptChatInviteTrigger(type, name, options));
                    break;

                case TriggerType.AcceptFriendRequestTrigger:
                    temp.Add(new AcceptFriendRequestTrigger(type, name, options));
                    break;

                case TriggerType.AntispamTrigger:
                    temp.Add(new AntispamTrigger(type, name, options));
                    break;

                case TriggerType.AutojoinChatTrigger:
                    temp.Add(new AutojoinChatTrigger(type, name, options));
                    break;

                case TriggerType.BanCheckTrigger:
                    temp.Add(new BanCheckTrigger(type, name, options));
                    break;

                case TriggerType.BanTrigger:
                    temp.Add(new BanTrigger(type, name, options));
                    break;

                case TriggerType.ChangeNameTrigger:
                    temp.Add(new ChangeNameTrigger(type, name, options));
                    break;

                case TriggerType.ChatReplyTrigger:
                    temp.Add(new ChatReplyTrigger(type, name, options));
                    break;

                case TriggerType.DiscordTrigger:
                    temp.Add(new DiscordTrigger(type, name, options));
                    break;

                case TriggerType.DoormatTrigger:
                    temp.Add(new DoormatTrigger(type, name, options));
                    break;

                case TriggerType.GoogleTrigger:
                    temp.Add(new GoogleTrigger(type, name, options));
                    break;

                case TriggerType.IsUpTrigger:
                    temp.Add(new IsUpTrigger(type, name, options));
                    break;

                case TriggerType.KickTrigger:
                    temp.Add(new KickTrigger(type, name, options));
                    break;

                case TriggerType.LeaveChatTrigger:
                    temp.Add(new LeaveChatTrigger(type, name, options));
                    break;

                case TriggerType.LinkNameTrigger:
                    temp.Add(new LinkNameTrigger(type, name, options));
                    break;

                case TriggerType.LockChatTrigger:
                    temp.Add(new LockChatTrigger(type, name, options));
                    break;

                case TriggerType.MessageIntervalTrigger:
                    temp.Add(new MessageIntervalTrigger(type, name, options));
                    break;

                case TriggerType.ModerateChatTrigger:
                    temp.Add(new ModerateChatTrigger(type, name, options));
                    break;

                case TriggerType.NoteTrigger:
                    temp.Add(new NoteTrigger(type, name, options));
                    break;

                case TriggerType.NotificationTrigger:
                    temp.Add(new NotificationTrigger(type, name, options));
                    break;

                case TriggerType.PlayGameTrigger:
                    temp.Add(new PlayGameTrigger(type, name, options));
                    break;

                case TriggerType.UnbanTrigger:
                    temp.Add(new UnbanTrigger(type, name, options));
                    break;

                case TriggerType.UnlockChatTrigger:
                    temp.Add(new UnlockChatTrigger(type, name, options));
                    break;

                case TriggerType.UnmoderateChatTrigger:
                    temp.Add(new UnmoderateChatTrigger(type, name, options));
                    break;

                case TriggerType.WeatherTrigger:
                    temp.Add(new WeatherTrigger(type, name, options));
                    break;

                case TriggerType.YoutubeTrigger:
                    temp.Add(new YoutubeTrigger(type, name, options));
                    break;

                default:
                    break;
                }
            }
            return(temp);
        }
Exemplo n.º 17
0
        private async void editButton_Click(object sender, RoutedEventArgs e)
        {
            if (addedTriggersListBox.SelectedIndex == -1)
            {
                MessageDialog dialog = new MessageDialog("You must select a trigger to edit from the box to the right.", "Error");
                await dialog.ShowAsync();
            }
            else
            {
                BaseTrigger trigger = Bot.Triggers[addedTriggersListBox.SelectedIndex];
                switch (trigger.Type)
                {
                case TriggerType.ChatReplyTrigger:
                {
                    ChatReplyWindow     crw    = new ChatReplyWindow(trigger.Options.ChatReply);
                    ContentDialogResult result = await crw.ShowAsync();

                    if (result == ContentDialogResult.Primary)
                    {
                        MainOptionsWindow   mow     = new MainOptionsWindow(trigger.Options.MainOptions);
                        ContentDialogResult result1 = await mow.ShowAsync();

                        if (result1 == ContentDialogResult.Primary)
                        {
                            TriggerOptionsBase options = new TriggerOptionsBase()
                            {
                                Name        = crw.CR.Name,
                                Type        = TriggerType.ChatReplyTrigger,
                                ChatReply   = crw.CR,
                                MainOptions = mow.MO
                            };
                            addedTriggersListBox.Items[addedTriggersListBox.SelectedIndex] = options.Name + " - " + options.Type.ToString();
                            StorageFile oldFile = await Bot.triggerDir.GetFileAsync(trigger.Name + ".json");

                            await oldFile.DeleteAsync();

                            BaseTrigger newTrigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("Chaos.Triggers." + options.Type.ToString()), options.Type, options.Name, options);
                            await newTrigger.SaveTrigger();

                            Bot.Triggers.Remove(trigger);
                            trigger = null;
                            Bot.Triggers.Add(newTrigger);
                        }
                    }
                }
                break;

                case TriggerType.DoormatTrigger:
                {
                    DoormatOptionsWindow dow    = new DoormatOptionsWindow(trigger.Options.DoormatOptions);
                    ContentDialogResult  result = await dow.ShowAsync();

                    if (result == ContentDialogResult.Primary)
                    {
                        MainOptionsWindow   mow     = new MainOptionsWindow(trigger.Options.MainOptions);
                        ContentDialogResult result1 = await mow.ShowAsync();

                        if (result1 == ContentDialogResult.Primary)
                        {
                            TriggerOptionsBase options = new TriggerOptionsBase()
                            {
                                Name           = dow.DO.Name,
                                Type           = TriggerType.DoormatTrigger,
                                DoormatOptions = dow.DO,
                                MainOptions    = mow.MO
                            };
                            addedTriggersListBox.Items[addedTriggersListBox.SelectedIndex] = options.Name + " - " + options.Type.ToString();
                            StorageFile oldFile = await Bot.triggerDir.GetFileAsync(trigger.Name + ".json");

                            await oldFile.DeleteAsync();

                            BaseTrigger newTrigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("Chaos.Triggers." + options.Type.ToString()), options.Type, options.Name, options);
                            await newTrigger.SaveTrigger();

                            Bot.Triggers.Remove(trigger);
                            trigger = null;
                            Bot.Triggers.Add(newTrigger);
                        }
                    }
                }
                break;

                case TriggerType.IsUpTrigger:
                case TriggerType.KickTrigger:
                case TriggerType.PlayGameTrigger:
                {
                    ChatCommandWindow   ccw    = new ChatCommandWindow(trigger.Options.ChatCommand);
                    ContentDialogResult result = await ccw.ShowAsync();

                    if (result == ContentDialogResult.Primary)
                    {
                        MainOptionsWindow   mow     = new MainOptionsWindow(trigger.Options.MainOptions);
                        ContentDialogResult result1 = await mow.ShowAsync();

                        if (result1 == ContentDialogResult.Primary)
                        {
                            TriggerOptionsBase options = new TriggerOptionsBase()
                            {
                                Name        = ccw.CC.Name,
                                Type        = trigger.Type,
                                ChatCommand = ccw.CC,
                                MainOptions = mow.MO
                            };
                            addedTriggersListBox.Items[addedTriggersListBox.SelectedIndex] = options.Name + " - " + options.Type.ToString();
                            StorageFile oldFile = await Bot.triggerDir.GetFileAsync(trigger.Name + ".json");

                            await oldFile.DeleteAsync();

                            BaseTrigger newTrigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("Chaos.Triggers." + options.Type.ToString()), options.Type, options.Name, options);
                            await newTrigger.SaveTrigger();

                            Bot.Triggers.Remove(trigger);
                            trigger = null;
                            Bot.Triggers.Add(newTrigger);
                        }
                    }
                }
                break;
                }
            }
        }
Exemplo n.º 18
0
        private async void addButton_Click(object sender, RoutedEventArgs e)
        {
            string      selected = "";
            TriggerType type;

            try
            {
                selected = ((ListBoxItem)triggersListBox.SelectedValue).Name;
            }
            catch (Exception) { return; }

            ChatCommand    cc  = new ChatCommand();
            ChatCommandAPI cca = new ChatCommandAPI();
            ChatReply      cr  = new ChatReply();
            DoormatOptions _do = new DoormatOptions();

            TriggerOptionsBase tob = new TriggerOptionsBase();

            switch (selected)
            {
            case "kickTrigger":
            case "banTrigger":
            case "isUpTrigger":
            case "playGameTrigger":
            case "chooseTrigger":
            case "helpTrigger":
            {
                ChatCommandWindow   window = new ChatCommandWindow();
                ContentDialogResult result = await window.ShowAsync();

                if (result == ContentDialogResult.Primary && window.CC != null)
                {
                    MainOptionsWindow   mow = new MainOptionsWindow();
                    ContentDialogResult r1  = await mow.ShowAsync();

                    if (r1 == ContentDialogResult.Primary && mow.MO != null)
                    {
                        cc = window.CC;

                        type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));
                        addedTriggersListBox.Items.Add(string.Format("{0} - {1}", cc.Name, type.ToString()));

                        tob.ChatCommand = cc;
                        tob.Name        = cc.Name;
                        tob.Type        = type;
                        tob.MainOptions = mow.MO;
                        BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("Chaos.Triggers." + type.ToString()), type, cc.Name, tob);
                        Bot.Triggers.Add(trigger);
                    }
                }
            }
            break;

            case "chatReplyTrigger":
            {
                ChatReplyWindow     window = new ChatReplyWindow();
                ContentDialogResult result = await window.ShowAsync();

                if (result == ContentDialogResult.Primary && window.CR != null)
                {
                    MainOptionsWindow   mow = new MainOptionsWindow();
                    ContentDialogResult r1  = await mow.ShowAsync();

                    if (r1 == ContentDialogResult.Primary && mow.MO != null)
                    {
                        cr   = window.CR;
                        type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));

                        tob.ChatReply   = cr;
                        tob.Name        = cr.Name;
                        tob.Type        = type;
                        tob.MainOptions = mow.MO;
                        addedTriggersListBox.Items.Add(string.Format("{0} - {1}", cr.Name, type.ToString()));
                        BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("Chaos.Triggers." + type.ToString()), type, cr.Name, tob);
                        Bot.Triggers.Add(trigger);
                    }
                }
            }
            break;

            case "doormatTrigger":
            {
                DoormatOptionsWindow window = new DoormatOptionsWindow();
                ContentDialogResult  result = await window.ShowAsync();

                if (result == ContentDialogResult.Primary && window.DO != null)
                {
                    MainOptionsWindow   mow = new MainOptionsWindow();
                    ContentDialogResult r1  = await mow.ShowAsync();

                    if (r1 == ContentDialogResult.Primary && mow.MO != null)
                    {
                        _do = window.DO;

                        type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));
                        addedTriggersListBox.Items.Add(string.Format("{0} - {1}", _do.Name, type.ToString()));

                        tob.DoormatOptions = _do;
                        tob.Name           = _do.Name;
                        tob.Type           = type;
                        tob.MainOptions    = mow.MO;
                        BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("Chaos.Triggers." + type.ToString()), type, _do.Name, tob);
                        Bot.Triggers.Add(trigger);
                    }
                }
            }
            break;

            case "cSGOStatTrigger":
            {
                ChatCommandAPIWindow window = new ChatCommandAPIWindow();
                ContentDialogResult  result = await window.ShowAsync();

                if (result == ContentDialogResult.Primary && window.CCAPI != null)
                {
                    ChatCommandWindow   ccw = new ChatCommandWindow();
                    ContentDialogResult r2  = await ccw.ShowAsync();

                    if (r2 == ContentDialogResult.Primary && ccw.CC != null)
                    {
                        MainOptionsWindow   mow = new MainOptionsWindow();
                        ContentDialogResult r1  = await mow.ShowAsync();

                        if (r1 == ContentDialogResult.Primary && mow.MO != null)
                        {
                            cca             = window.CCAPI;
                            cca.ChatCommand = ccw.CC;

                            type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));
                            addedTriggersListBox.Items.Add(string.Format("{0} - {1}", cca.ChatCommand.Name, type.ToString()));

                            tob.ChatCommandAPI             = cca;
                            tob.ChatCommandAPI.ChatCommand = cca.ChatCommand;
                            tob.Name        = cca.ChatCommand.Name;
                            tob.Type        = type;
                            tob.MainOptions = mow.MO;
                            BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("Chaos.Triggers." + type.ToString()), type, _do.Name, tob);
                            Bot.Triggers.Add(trigger);
                        }
                    }
                }
            }
            break;
            }
        }
 public AcceptFriendRequestTrigger(TriggerType type, string name, TriggerOptionsBase tl) : base(type, name, tl)
 {
 }
Exemplo n.º 20
0
 public BanCheckTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
 {
 }
Exemplo n.º 21
0
 public AutojoinChatTrigger(TriggerType type, string name, TriggerOptionsBase tl) : base(type, name, tl)
 {
 }
Exemplo n.º 22
0
 public NotificationTrigger(TriggerType type, string name, TriggerOptionsBase options) : base(type, name, options)
 {
     saveTimer          = new Timer(Options.NotificationOptions.SaveTimer);
     saveTimer.Elapsed += SaveTimer_Elapsed;
 }
Exemplo n.º 23
0
        private void plusTriggerButton_Click(object sender, RoutedEventArgs e)
        {
            string      selected = "";
            TriggerType type;

            try
            {
                selected = ((ListBoxItem)triggerListBox.SelectedValue).Name;
            }
            catch (Exception err) { return; }


            ChatCommand            cc   = new ChatCommand();
            ChatCommandApi         cca  = new ChatCommandApi();
            ChatReply              cr   = new ChatReply();
            NoCommand              nc   = new NoCommand();
            TriggerLists           tl   = new TriggerLists();
            TriggerNumbers         tn   = new TriggerNumbers();
            AntiSpamTriggerOptions asto = new AntiSpamTriggerOptions();
            DiscordOptions         _do  = new DiscordOptions(); // "do" is a keyword
            NoteTriggerOptions     nto  = new NoteTriggerOptions();
            NotificationOptions    no   = new NotificationOptions();
            MessageIntervalOptions mio  = new MessageIntervalOptions();

            TriggerOptionsBase tob = new TriggerOptionsBase();

            if (selected == "isUpTrigger" || selected == "leaveChatTrigger" || selected == "kickTrigger" ||
                selected == "banTrigger" || selected == "unbanTrigger" || selected == "lockTrigger" ||
                selected == "unlockTrigger" || selected == "moderateTrigger" || selected == "unmoderateTrigger" ||
                selected == "playGameTrigger" || selected == "changeNameTrigger" || selected == "googleTrigger")
            {
                ChatCommandWindow ccw = new ChatCommandWindow();
                ccw.ShowDialog();
                if (ccw.DialogResult.HasValue && ccw.DialogResult.Value)
                {
                    cc = ccw.CC;

                    type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));
                    addedTriggersListBox.Items.Add(string.Format("{0} - {1}", cc.Name, type.ToString()));

                    tob.ChatCommand = cc;
                    tob.Name        = cc.Name;
                    tob.Type        = type;
                    BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, cc.Name, tob);
                    Bot.triggers.Add(trigger);
                }
            }
            else if (selected == "chatReplyTrigger")
            {
                ChatReplyWindow crw = new ChatReplyWindow();
                crw.ShowDialog();
                if (crw.DialogResult.HasValue && crw.DialogResult.Value)
                {
                    cr   = crw.CR;
                    type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));

                    tob.ChatReply = cr;
                    tob.Name      = cr.Name;
                    tob.Type      = type;
                    addedTriggersListBox.Items.Add(string.Format("{0} - {1}", cr.Name, type.ToString()));
                    BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, cr.Name, tob);
                    Bot.triggers.Add(trigger);
                }
            }
            else if (selected == "linkNameTrigger" || selected == "doormatTrigger")
            {
                NoCommandWindow ncw = new NoCommandWindow();
                ncw.ShowDialog();
                if (ncw.DialogResult.HasValue && ncw.DialogResult.Value)
                {
                    nc   = ncw.NC;
                    type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));

                    tob.NoCommand = nc;
                    tob.Name      = nc.Name;
                    tob.Type      = type;
                    addedTriggersListBox.Items.Add(string.Format("{0} - {1}", nc.Name, type.ToString()));
                    BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, nc.Name, tob);
                    Bot.triggers.Add(trigger);
                }
            }
            else if (selected == "banCheckTrigger" || selected == "weatherTrigger" || selected == "youtubeTrigger")
            {
                ChatCommandApiWindow ccaw = new ChatCommandApiWindow();
                switch (selected)
                {
                case "banCheckTrigger":
                    ccaw.apiBlock.PreviewMouseDown += (sender1, e1) => Ccaw_PreviewMouseDown_Steam(sender1, e1, ccaw);
                    break;

                case "weatherTrigger":
                    ccaw.apiBlock.PreviewMouseDown += (sender1, e1) => Ccaw_PreviewMouseDown_Wunderground(sender1, e1, ccaw);
                    break;

                case "youtubeTrigger":
                    ccaw.apiBlock.PreviewMouseDown += (sender1, e1) => Ccaw_PreviewMouseDown1_Google(sender1, e1, ccaw);
                    break;
                }
                ccaw.ShowDialog();
                if (ccaw.DialogResult.HasValue && ccaw.DialogResult.Value)
                {
                    cca = ccaw.CCA;
                    cc  = ccaw.CC;

                    type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));

                    tob.ChatCommandApi             = cca;
                    tob.ChatCommandApi.ChatCommand = cc;
                    tob.Name = cca.Name;
                    tob.Type = type;
                    addedTriggersListBox.Items.Add(string.Format("{0} - {1}", cc.Name, type.ToString()));
                    BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, cc.Name, tob);
                    Bot.triggers.Add(trigger);
                }
            }
            else if (selected == "acceptFriendRequestTrigger" || selected == "autojoinChatTrigger" || selected == "acceptChatInviteTrigger")
            {
                TriggerListWindow tlw = new TriggerListWindow(selected);
                tlw.ShowDialog();
                if (tlw.DialogResult.HasValue && tlw.DialogResult.Value)
                {
                    tl   = tlw.TL;
                    type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));

                    tob.TriggerLists = tl;
                    tob.Name         = tl.Name;
                    tob.Type         = type;
                    addedTriggersListBox.Items.Add(string.Format("{0} - {1}", tl.Name, type));
                    BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, tl.Name, tob);
                    Bot.triggers.Add(trigger);
                }
            }
            else if (selected == "antispamTrigger")
            {
                AntiSpamTriggerOptionsWindow astow = new AntiSpamTriggerOptionsWindow();
                astow.ShowDialog();
                if (astow.DialogResult.HasValue && astow.DialogResult.Value)
                {
                    asto = astow.ASTO;
                    nc   = astow.NC;

                    type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));

                    tob.AntiSpamTriggerOptions           = asto;
                    tob.AntiSpamTriggerOptions.NoCommand = nc;
                    tob.Name = asto.Name;
                    tob.Type = type;
                    addedTriggersListBox.Items.Add(string.Format("{0} - {1}", asto.Name, type));
                    BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, asto.Name, tob);
                    Bot.triggers.Add(trigger);
                }
            }
            else if (selected == "discordTrigger")
            {
                DiscordTriggerOptionsWindow dtow = new DiscordTriggerOptionsWindow();
                dtow.ShowDialog();
                if (dtow.DialogResult.HasValue && dtow.DialogResult.Value)
                {
                    _do  = dtow.DO;
                    nc   = dtow.NC;
                    type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));

                    tob.DiscordOptions           = _do;
                    tob.DiscordOptions.NoCommand = nc;
                    tob.Name = _do.Name;
                    tob.Type = type;
                    addedTriggersListBox.Items.Add(string.Format("{0} - {1}", _do.Name, type));
                    BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, _do.Name, tob);
                    Bot.triggers.Add(trigger);
                }
            }
            else if (selected == "noteTrigger")
            {
                NoteTriggerOptionsWindow ntow = new NoteTriggerOptionsWindow();
                ntow.ShowDialog();
                if (ntow.DialogResult.HasValue && ntow.DialogResult == true)
                {
                    nc   = ntow.NC;
                    nto  = ntow.NTO;
                    type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));

                    tob.NoteTriggerOptions           = nto;
                    tob.NoteTriggerOptions.NoCommand = nc;
                    tob.Name = nto.Name;
                    tob.Type = type;
                    addedTriggersListBox.Items.Add(string.Format("{0} - {1}", nto.Name, type));
                    BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, nto.Name, tob);
                    Bot.triggers.Add(trigger);
                }
            }
            else if (selected == "notificationTrigger")
            {
                NotificationOptionsWindow now = new NotificationOptionsWindow();
                now.ShowDialog();
                if (now.DialogResult.HasValue && now.DialogResult == true)
                {
                    nc   = now.NC;
                    no   = now.NO;
                    type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));

                    tob.NotificationOptions           = no;
                    tob.NotificationOptions.NoCommand = nc;
                    tob.Name = Name;
                    tob.Type = type;
                    addedTriggersListBox.Items.Add(string.Format("{0} - {1}", no.Name, type));
                    BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, no.Name, tob);
                    Bot.triggers.Add(trigger);
                }
            }
            else if (selected == "messageIntervalTrigger")
            {
                MessageIntervalOptionsWindow miow = new MessageIntervalOptionsWindow();
                miow.ShowDialog();
                if (miow.DialogResult.HasValue && miow.DialogResult == true)
                {
                    mio  = miow.MIO;
                    type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1));

                    tob.MessageIntervalOptions = mio;
                    tob.Name = Name;
                    tob.Type = type;
                    addedTriggersListBox.Items.Add(string.Format("{0} - {1}", mio.Name, type));
                    BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, mio.Name, tob);
                    Bot.triggers.Add(trigger);
                }
            }
            else
            {
                MessageBox.Show("Unknown Trigger. Please contact the developer.", "Error", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
            }
        }