private async void TwitchOnWhisperReceived(object sender, TwitchLib.Client.Events.OnWhisperReceivedArgs e) { UserEntry user = await Program.Users.GetUserByTwitchID(e.WhisperMessage.UserId); if (user == null) { return; } string message = e.WhisperMessage.Message.Trim(); string[] args = message.Split(' '); if (args.Length != 1) { return; } int pin = 000000; int.TryParse(args[0], out pin); if (pin == 000000) { return; } if (Tokens.Exists(p => p.PIN == pin)) { LinkToken token = Tokens.Find(p => p.PIN == pin); token.twitchID = e.WhisperMessage.UserId; MatchToken(token); } }
private void TwitchClient_OnWhisperReceived(object sender, TwitchLib.Client.Events.OnWhisperReceivedArgs e) { WhisperMessage whisperMessage = e.WhisperMessage; string msg = whisperMessage.Message; switch (msg) { case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": case "y": case "Y": case "n": case "N": SilentAnswerQuiz(msg, whisperMessage); break; } }
private void Client_OnWhisperReceived(object sender, TwitchLib.Client.Events.OnWhisperReceivedArgs e) { Logger.Instance.LogMessage(TracingLevel.DEBUG, $"***Whisper: {e.WhisperMessage.Username}: {e.WhisperMessage.Message}"); }
private void Client_OnWhisperReceived(object sender, TwitchLib.Client.Events.OnWhisperReceivedArgs e) { string message = e.WhisperMessage.Message.ToLower(); if (message.Length == 0 || message[0] != '!') { return; } if (e.WhisperMessage.Message.ToLower() == "!commentators") { if (Comm1Name.Text != "") { string response = "Commentator 1: " + Comm1Name.Text; if (Comm1Twitter.Text != "") { message += " Twitter: https://twitter.com/" + Comm1Twitter.Text.Replace("@", ""); } client.SendMessage(client.JoinedChannels[0], response); } if (Comm2Name.Text != "") { string response = "Commentator 2: " + Comm2Name.Text; if (Comm2Twitter.Text != "") { message += " Twitter: https://twitter.com/" + Comm2Twitter.Text.Replace("@", ""); } client.SendMessage(client.JoinedChannels[0], response); } } if (message == "!scoreboard" || message == "!help") { List <string> controlNames = new List <string>(); controls.Where(c => c is TextBox || c is NumericUpDown || c is ComboBox).ToList().ForEach(c => controlNames.Add(c.Name)); client.SendMessage(client.JoinedChannels[0], "To operate the scoreboard, type the name of a field (not case sensitive) followed by the value. Here is a list of useful fields: Player1Name, Player2Name, Player1Score, Player2Score, round. For a full list of fields type !fields. Other commands include !scoreboard and !reset"); return; } else if (message == "!fields") { } else if (message.equalsIgnoreCase("!reset")) { resetButton.Invoke((MethodInvoker)(() => resetButton.PerformClick())); return; } message = message.Replace("!", ""); List <string> messageWords = e.WhisperMessage.Message.Replace("!", "").Split(' ').ToList(); if (messageWords.Count >= 2) { string controlName = messageWords[0]; Console.WriteLine(controlName); Control control = controls.Find(c => c.Name.ToLower() == controlName.ToLower()); if (control != null) { int messageValue; int.TryParse(messageWords[1], out messageValue); if (messageValue != null && control is NumericUpDown) { NumericUpDown c = control as NumericUpDown; c.Invoke((MethodInvoker)(() => c.Value = messageValue)); SendUpdateButton.Invoke((MethodInvoker)(() => SendUpdateButton.PerformClick())); return; } control.Invoke((MethodInvoker)(() => control.Text = string.Join(" ", messageWords.GetRange(1, messageWords.Count - 1)))); SendUpdateButton.Invoke((MethodInvoker)(() => SendUpdateButton.PerformClick())); } } }
private void Client_OnWhisperReceived(object sender, TwitchLib.Client.Events.OnWhisperReceivedArgs e) { //client.SendWhisper(e.WhisperMessage.Username, $"your said: { e.WhisperMessage.Message}"); }
private void Client_OnWhisperReceived(object sender, TwitchLib.Client.Events.OnWhisperReceivedArgs e) { Console.WriteLine($"{e.WhisperMessage.Username} has whispered {e.WhisperMessage.Message}."); }