Beispiel #1
0
 private void chatCommandReceived(object sender, TwitchClient.OnChatCommandReceivedArgs e)
 {
     listBox1.Items.Add(e.ChatMessage.Username + ": " + e.Command + "; args: " + e.ArgumentsAsString + ";");
     foreach (string arg in e.ArgumentsAsList)
     {
         Console.WriteLine("[chat] arg: " + arg);
     }
     Console.WriteLine("[chat] args as string: " + e.ArgumentsAsString);
 }
Beispiel #2
0
 private void chatCommandReceived(object sender, TwitchClient.OnChatCommandReceivedArgs e)
 {
     listBox1.Items.Add("[#" + e.Command.ChatMessage.Channel + "]" + e.Command.ChatMessage.Username + ": " + e.Command + "; args: " + e.Command.ArgumentsAsString + ";");
     foreach (string arg in e.Command.ArgumentsAsList)
     {
         Console.WriteLine("[chat] arg: " + arg);
     }
     Console.WriteLine($"[chat] command identifier: {e.Command.CommandIdentifier}");
     Console.WriteLine($"[chat] arg count: {e.Command.ArgumentsAsList.Count}");
     Console.WriteLine("[chat] args as string: " + e.Command.ArgumentsAsString);
 }
        private void chatCommandReceived(object sender, TwitchClient.OnChatCommandReceivedArgs e)
        {
            switch (e.Command.Command)
            {
            case "vote":
                if (isDrafting)
                {
                    if (currentPick % 2 == 0)
                    {
                        if (e.Command.ArgumentsAsList.Count > 1 || e.Command.ArgumentsAsList.Count == 0)
                        {
                            break;
                        }
                        switch (e.Command.ArgumentsAsList[0])
                        {
                        case "1":
                            if (votedUser.Contains(e.Command.ChatMessage.UserId))
                            {
                                twitchClient.SendMessage("@" + e.Command.ChatMessage.DisplayName + "," + "nur eine Stimme pro Pick erlaubt.");
                                break;
                            }
                            votedUser.Add(e.Command.ChatMessage.UserId);
                            scoreCard1++;
                            break;

                        case "2":
                            if (votedUser.Contains(e.Command.ChatMessage.UserId))
                            {
                                twitchClient.SendMessage("@" + e.Command.ChatMessage.DisplayName + "," + "nur eine Stimme pro Pick erlaubt.");
                                break;
                            }
                            votedUser.Add(e.Command.ChatMessage.UserId);
                            scoreCard2++;
                            break;

                        case "3":
                            if (votedUser.Contains(e.Command.ChatMessage.UserId))
                            {
                                twitchClient.SendMessage("@" + e.Command.ChatMessage.DisplayName + "," + "nur eine Stimme pro Pick erlaubt.");
                                break;
                            }
                            votedUser.Add(e.Command.ChatMessage.UserId);
                            scoreCard3++;
                            break;

                        default:
                            twitchClient.SendMessage("@" + e.Command.ChatMessage.DisplayName + "," + "nur !vote 1, !vote 2 oder !vote 3 erlaubt.");
                            break;
                        }
                    }
                    else
                    {
                        if (e.Command.ArgumentsAsList.Count > 1 || e.Command.ArgumentsAsList.Count == 0)
                        {
                            break;
                        }
                        switch (e.Command.ArgumentsAsList[0])
                        {
                        case "a":
                            if (votedUser.Contains(e.Command.ChatMessage.UserId))
                            {
                                twitchClient.SendMessage("@" + e.Command.ChatMessage.DisplayName + "," + "nur eine Stimme pro Pick erlaubt.");
                                break;
                            }
                            votedUser.Add(e.Command.ChatMessage.UserId);
                            scoreCard1++;
                            break;

                        case "b":
                            if (votedUser.Contains(e.Command.ChatMessage.UserId))
                            {
                                twitchClient.SendMessage("@" + e.Command.ChatMessage.DisplayName + "," + "nur eine Stimme pro Pick erlaubt.");
                                break;
                            }
                            votedUser.Add(e.Command.ChatMessage.UserId);
                            scoreCard2++;
                            break;

                        case "c":
                            if (votedUser.Contains(e.Command.ChatMessage.UserId))
                            {
                                twitchClient.SendMessage("@" + e.Command.ChatMessage.DisplayName + "," + "nur eine Stimme pro Pick erlaubt.");
                                break;
                            }
                            votedUser.Add(e.Command.ChatMessage.UserId);
                            scoreCard3++;
                            break;

                        default:
                            twitchClient.SendMessage("@" + e.Command.ChatMessage.DisplayName + "," + "nur !vote a, !vote b oder !vote c erlaubt.");
                            break;
                        }
                    }
                }
                break;

            case "dev":
                twitchClient.SendMessage("Ich wurde im Jahr 2016 von @exceptionptr programmiert.");
                break;

            default:
                break;
            }
        }