private void startRaffleButton_Click(object sender, EventArgs e) { raffle = new Raffle(); raffle.StartRaffle(int.TryParse(entryfeeBox.Text, out var entryfee) ? entryfee : 0, TextBoxHandler.CheckForInput(keywordBox, out string keyword) ? (keywordCaseSensitive.Checked ? keyword : keyword.ToLower()) : "", TextBoxHandler.CheckForInput(timerBox, out string timerText) ? int.Parse(timerText) : 1, followerBar.Value, subscriberBar.Value); }
private void SetupBot() { _channelIsSet = TextBoxHandler.CheckForInput(channelTextBox, out var channelText); ChatLink.Channel = channelText; _botnameIsSet = TextBoxHandler.CheckForInput(botnameTextBox, out var botnameText); ChatLink.Username = botnameText; _tokenIsSet = TextBoxHandler.CheckForInput(tokenTextBox, out var passwordText); ChatLink.Password = passwordText; minigamesButton.Show(); if (_channelIsSet && _botnameIsSet && _tokenIsSet) { SaveValues(); StartBot(); } }
private void saveCommandButton_Click(object sender, EventArgs e) { dynamic allCommands = File.ReadAllText("userbotcommands.txt"); if (allCommands.Length > 0) { commandArray = JArray.Parse(allCommands); } Command command = new Command(); commandIsSet = TextBoxHandler.CheckForInput(commandTextBox, out var commandText); if (commandText.StartsWith(ChatLink.BotCommandPrefix)) { commandText = commandText.Replace(ChatLink.BotCommandPrefix, ""); } command.CommandText = commandText; responseIsSet = TextBoxHandler.CheckForInput(responseTextBox, out var responseText); command.Response = responseText; descriptionIsSet = TextBoxHandler.CheckForInput(descriptionTextBox, out var descriptionText); command.Description = descriptionText; if (commandIsSet && responseIsSet && descriptionIsSet) { commands.Add(command); commandArray.Add(commands.Select(c => new JObject { { "IsBotCommand", false }, { "CommandText", c.CommandText }, { "Response", c.Response }, { "Description", c.Description } })); File.WriteAllText("userbotcommands.txt", commandArray.ToString()); this.Close(); } }