private void button3_Click(object sender, EventArgs e) { ConnectionCredentials credentials = new ConnectionCredentials(ConnectionCredentials.ClientType.Whisper, new TwitchIpAndPort(true), textBox6.Text, textBox7.Text); TwitchWhisperClient newClient = new TwitchWhisperClient(credentials, '!'); newClient.OnWhisperReceived += new EventHandler<TwitchWhisperClient.OnWhisperReceivedArgs>(globalWhisperReceived); newClient.OnCommandReceived += new EventHandler<TwitchWhisperClient.OnCommandReceivedArgs>(whisperCommandReceived); newClient.OnIncorrectLogin += new EventHandler<TwitchWhisperClient.OnIncorrectLoginArgs>(incorrectWhisperLogin); newClient.OnConnected += new EventHandler<TwitchWhisperClient.OnConnectedArgs>(onWhisperConnected); newClient.Connect(); whisperClients.Add(newClient); ListViewItem lvi = new ListViewItem(); lvi.Text = textBox6.Text; lvi.SubItems.Add("WHISPER"); lvi.SubItems.Add("N/A"); listView1.Items.Add(lvi); comboBox1.Items.Add(textBox6.Text); }
public void onWhisperConnected(object sender, TwitchWhisperClient.OnConnectedArgs e) { MessageBox.Show("Connected to whisper group chat under username: " + e.Username); }
private void whisperCommandReceived(object sender, TwitchWhisperClient.OnCommandReceivedArgs e) { listBox2.Items.Add(e.Username + ": " + e.Command + "; args: " + e.ArgumentsAsString + ";"); foreach (string arg in e.ArgumentsAsList) { Console.WriteLine("[whisper] arg: " + arg); } Console.WriteLine("[whisper] args as string: " + e.ArgumentsAsString); }
private void globalWhisperReceived(object sender, TwitchWhisperClient.OnWhisperReceivedArgs e) { //Don't do this in production CheckForIllegalCrossThreadCalls = false; richTextBox2.Text = String.Format("{0} -> {1}: {2}", e.WhisperMessage.Username, e.WhisperMessage.BotUsername, e.WhisperMessage.Message) + "\n" + richTextBox2.Text; }
public void incorrectWhisperLogin(object sender, TwitchWhisperClient.OnIncorrectLoginArgs e) { MessageBox.Show("Failed login as whisper client!!!\nException: " + e.Exception + "\nUsername: " + e.Exception.Username); }