public void Handle(object sender, EditOperationRequestEventArgs e) { string message = string.Empty; CustomCommand cc = FetchFromSet(e.RequestName, customCommandRepository.GetAll()); if (DeleteCommand(cc)) { int cooldown = e.isCooldownDefault ? cc.Cooldown : e.GetCooldown(); string[] users = e.isPermittedUsersDefault ? cc.PermittedUsers.ToArray() : e.GetPermittedUsers(); CustomCommand toAdd = customCommandFactory.Create(e.RequestName, e.RequestValue, e.GetCooldown(), e.GetPermittedUsers()); if (AddCommand(toAdd)) { message = string.Format("!{0} command has been updated!", e.RequestName); } else if (AddCommand(cc)) { message = string.Format("!{0} command has NOT been updated, please " + "the edit operation syntax for errors.", e.RequestName); } else { message = string.Format("!{0} has been corrupted during updating, " + "please using the add operation to make this command."); } } else { message = "Unable to change the command at this time!"; } client.SendMessage(message); }
public void OnEvent(EditOperationRequestEventArgs e) { EditOperationHandler(this, e); }