private static void editCommand(string commandInput, string nickname) { string[] words = commandInput.Split(' '); string trigger = words[1]; List <string> responseWords = new List <string>(); int responseIndex = 2; userLevels level = userLevels.User; if (commandInput.Contains("ul=")) { responseIndex = 3; trigger = words[2]; string levelInput = words[1]; levelInput = levelInput.Replace("ul=", ""); if (levelInput == "owner") { level = userLevels.Owner; } else if (levelInput == "mod") { level = userLevels.Mod; } else if (levelInput == "reg") { level = userLevels.Regular; } } for (int i = responseIndex; i < words.Length; i++) { responseWords.Add(words[i]); } string response = String.Join(" ", responseWords); for (int i = 0; i < commands.Count; i++) { if (commands[i].trigger == trigger) { commands.Add(new Command(trigger, level, response)); commands.Remove(commands[i]); break; } } saveCommands(); Console.WriteLine(nickname + " - Editing command - " + trigger + ", " + response); toDo.Enqueue("PRIVMSG " + CHANNEL + " :" + nickname + "-> Edited command " + trigger); }
public Command(string trigger, userLevels level, string response) { this.trigger = trigger; this.level = level; this.response = response; }