public AutojoinChatTrigger(TriggerType type, string name, TriggerLists tl) : base(type, name, tl) { }
public AcceptChatInviteTrigger(TriggerType type, string name, TriggerLists tl) : base(type, name, tl) { }
public AcceptFriendRequestTrigger(TriggerType type, string name, TriggerLists tl) : base(type, name, tl) { }
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); } }
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(); if (selected == "isUpTrigger" || selected == "leaveChatTrigger" || selected == "kickTrigger" || selected == "banTrigger" || selected == "unbanTrigger" || selected == "lockTrigger" || selected == "unlockTrigger" || selected == "moderateTrigger" || selected == "unmoderateTrigger" || selected == "playGameTrigger") { ChatCommandWindow ccw = new ChatCommandWindow(); ccw.ShowDialog(); if (ccw.DialogResult.HasValue && ccw.DialogResult.Value) { ChatCommand ccw_cc = ccw.CC; cc = GetChatCommandOptions(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())); BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, cc.Name, cc); Bot.triggers.Add(trigger); } } else if (selected == "chatReplyTrigger") { ChatReplyWindow crw = new ChatReplyWindow(); crw.ShowDialog(); if (crw.DialogResult.HasValue && crw.DialogResult.Value) { ChatReply crw_cr = crw.CR; cr = GetChatReplyOptions(crw_cr); type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); 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, cr); Bot.triggers.Add(trigger); } } else if (selected == "linkNameTrigger" || selected == "doormatTrigger") { NoCommandWindow ncw = new NoCommandWindow(); ncw.ShowDialog(); if (ncw.DialogResult.HasValue && ncw.DialogResult.Value) { NoCommand ncw_nc = ncw.NC; nc = GetNoCommandOptions(ncw_nc); type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); 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, nc); Bot.triggers.Add(trigger); } } else if (selected == "banCheckTrigger" || selected == "weatherTrigger") { ChatCommandApiWindow ccaw = new ChatCommandApiWindow(); ccaw.ShowDialog(); if (ccaw.DialogResult.HasValue && ccaw.DialogResult.Value) { ChatCommandApi ccaw_cca = ccaw.CCA; cca = GetChatCommandApiOptions(ccaw_cca); type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); addedTriggersListBox.Items.Add(string.Format("{0} - {1}", cca.Name, type.ToString())); BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, cca.Name, cca); 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) { TriggerLists tlw_tl = tlw.TL; tl = GetTriggerListOptions(tlw_tl); type = (TriggerType)Enum.Parse(typeof(TriggerType), char.ToUpper(selected[0]) + selected.Substring(1)); addedTriggersListBox.Items.Add(string.Format("{0} - {1}", tl.Name, type)); BaseTrigger trigger = (BaseTrigger)Activator.CreateInstance(Type.GetType("SteamChatBot.Triggers." + type.ToString()), type, tl.Name, tl); Bot.triggers.Add(trigger); } } else { MessageBox.Show("Unknown Trigger. Please contact the developer.", "Error", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); } }
private TriggerLists GetTriggerListOptions(TriggerLists tl) { try { return new TriggerLists { Name = tl.Name, Rooms = tl.Rooms, User = tl.User, Ignore = tl.Ignore }; } catch (Exception e) { return null; } }