private void buttonTokenRemove_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(comboBoxToken.Text)) { TokenContainer tc = Data.GetContainers <TokenContainer>(Data.FILE_PATH + Data.TOKEN_FILE).FirstOrDefault(x => x.name == comboBoxToken.Text || x.token == comboBoxToken.Text); if (tc != null) { Data.RemoveContainer(tc, Data.FILE_PATH + Data.TOKEN_FILE); comboBoxToken.Items.Remove(comboBoxToken.Text); comboBoxToken.Text = ""; } else { MessageBox.Show("The token you entered does not exist.", "ERROR: Could not find token!"); } } else { MessageBox.Show("You need to select a token before using this button.", "ERROR: Missing token!"); } }
private async void buttonStartBot_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(comboBoxToken.Text)) { /* * if(!comboBoxToken.Items.Contains(comboBoxToken.Text)) * { * comboBoxToken.Items.Add(comboBoxToken.Text); * Data.AddToken(comboBoxToken.Text); * }*/ string token = comboBoxToken.Text; TokenContainer tc = Data.GetContainers <TokenContainer>(Data.FILE_PATH + Data.TOKEN_FILE).FirstOrDefault(x => x.name == comboBoxToken.Text || x.token == comboBoxToken.Text); if (tc != null) { token = tc.token; } await bot.RunBotAsync(token); } else { MessageBox.Show("Please pick a token before starting the bot", "ERROR: Missing token!"); } }