Exemplo n.º 1
0
 private void Client_OnChatCommandReceived(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
 {
     if (CheckNumber(e.Command.CommandText))
     {
         Debug.Log(e.Command.CommandText);
     }
 }
Exemplo n.º 2
0
    private void OnChatCommandReceived(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
    {
        //Debug.Log(e.Command.ArgumentsAsString);
        //player.GetSentence(e.Command.ArgumentsAsString);

        /* switch (e.Command.CommandText)
         * {
         *   case "raffle":
         *       if (!subsOnly)
         *       {
         *           //RaffleList.Instance.AddName(e.Command.ChatMessage.DisplayName);
         *
         *           Debug.Log("lisätty raffleen");
         *       }
         *       else
         *       {
         *           if (e.Command.ChatMessage.IsSubscriber)
         *           {
         *               //RaffleList.Instance.AddName(e.Command.ChatMessage.DisplayName);
         *
         *               Debug.Log("lisätty subi raffleen");
         *           }
         *       }
         *       break;
         *
         *       case "benis":
         *            client.SendMessage(client.JoinedChannels[0], "Benis");
         *            break;
         *        case "help":
         *            client.SendMessage(client.JoinedChannels[0], "Not for you babe.");
         *            break;
         * }*/
    }
Exemplo n.º 3
0
        private void Client_OnChatCommandReceived(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
        {
            if (this.commands.ContainsKey(e.Command.CommandText.ToLower()) == false)
            {
                return;
            }

            this.commands[e.Command.CommandText.ToLower()].Execute(e);
        }
Exemplo n.º 4
0
    /// <summary>
    /// Function Triggered when we get a command from chat
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void ChatCommandReceived(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
    {
        //Get the UserID and Username from the command
        string incomingUserID   = e.Command.ChatMessage.UserId;
        string incomingUsername = e.Command.ChatMessage.Username;

        //Check for join command
        if (e.Command.CommandText.ToLower() == joinWord)
        {
            HandlePlayerJoin(incomingUserID, incomingUsername);
        }
    }
Exemplo n.º 5
0
    private void OnChatCommandReceived(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
    {
        switch (e.Command.CommandText)
        {
        case "up":
        case "down":
            otherFunctions.Invoke(e.Command.CommandText);
            break;

        default:
            break;
        }
    }
Exemplo n.º 6
0
    private void OnChatCommandReceived(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
    {
        switch (e.Command.CommandText)
        {
        case "up":
        case "down":
            chatEvents.Invoke(e.Command.CommandText);
            break;

        default:
            _client.SendMessage(e.Command.ChatMessage.Channel, $"Unknown chat command: {e.Command.CommandIdentifier}{e.Command.CommandText}");
            break;
        }
    }
Exemplo n.º 7
0
        private void OnChatCommandReceived(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
        {
            switch (e.Command.CommandText)
            {
            case "play":
                i = i - 1;

                Invoke((MethodInvoker) delegate
                {
                    lblCounter.Text = i.ToString();
                });
                break;
            }
        }
        private void Client_OnChatCommandReceived(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
        {
            var command = new BotCommand(
                e.Command.CommandText,
                e.Command.ArgumentsAsList,
                e.Command.ChatMessage.Username,
                e.Command.ChatMessage.ColorHex);
            var def = commandDefs.FirstOrDefault(x => x.CommandText == command.CommandText);

            if (def != null)
            {
                def.Handler.Handle(command);
            }
        }
Exemplo n.º 9
0
 private void CommandListen(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
 {
     if (e.Command.CommandText == "help")
     {
         Help();
     }
     else if (e.Command.CommandText == "Up" || e.Command.CommandText == "up" || e.Command.CommandText == "Down" || e.Command.CommandText == "down" ||
              e.Command.CommandText == "Left" || e.Command.CommandText == "left" || e.Command.CommandText == "Right" || e.Command.CommandText == "right")
     {
         catController.ChatMoveCommand(e.Command.CommandText);
     }
     else
     {
         client.SendMessage(client.JoinedChannels[0], "Command not recognized, please use !Help to get the list of commands.");
     }
 }
Exemplo n.º 10
0
    private void OnChatCommandReceived(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
    {
        switch (e.Command.CommandText)
        {
        case "hello":
            _client.SendMessage(e.Command.ChatMessage.Channel, $"Hello {e.Command.ChatMessage.DisplayName}!");
            break;

        case "about":
            _client.SendMessage(e.Command.ChatMessage.Channel, "I am a Twitch bot running on TwitchLib!");
            break;

        default:
            _client.SendMessage(e.Command.ChatMessage.Channel, $"Unknown chat command: {e.Command.CommandIdentifier}{e.Command.CommandText}");
            break;
        }
    }
    private void Client_OnChatCommandReceived(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
    {
        Debug.Log("Command entered");
        switch (e.Command.CommandText)
        {
        case "guess":
            Guess(e.Command.ArgumentsAsString, e.Command.ChatMessage.UserId, e.Command.ChatMessage.Channel);
            break;

        case "music":
            if (e.Command.ChatMessage.Channel != client.JoinedChannels[0].Channel)     // Don't respond in other channels
            {
                return;
            }
            Music(e.Command.ChatMessage.Channel);
            break;
        }
    }
Exemplo n.º 12
0
    /// <summary>
    /// Process player chat commands
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void ProcessPlayerCommands(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
    {
        //If the commands are not for this player then about
        if (e.Command.ChatMessage.Username != playerName)
        {
            return;
        }


        string commandText = e.Command.CommandText;

        if (commandDirectionPairs.ContainsKey(commandText))
        {
            ProcessPlayerMovement(commandText);
        }
        else if (commandText == attackCommand)
        {
            //Attack all players within range
            CreateAttack();
        }
    }
Exemplo n.º 13
0
    private void OnChatCommandReceived(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
    {
        switch (e.Command.CommandText)
        {
        case "hello":
            _client.SendMessage(e.Command.ChatMessage.Channel, $"Hello {e.Command.ChatMessage.DisplayName}!");
            break;

        case "about":
            _client.SendMessage(e.Command.ChatMessage.Channel, "I am a Twitch bot running on TwitchLib!");
            break;

        case "hit":

            if (e.Command.ArgumentsAsList.Count == 2)
            {
                int  angle, force;
                bool angleValid = int.TryParse(e.Command.ArgumentsAsList[0], out angle);
                bool forceValid = int.TryParse(e.Command.ArgumentsAsList[1], out force);

                if (angleValid && forceValid && Mathf.Abs(force) <= 10)
                {
                    float xcomponent = Mathf.Cos(angle * Mathf.PI / 180) * hitForceMultiplier * force;
                    float ycomponent = Mathf.Sin(angle * Mathf.PI / 180) * hitForceMultiplier * force;

                    body.AddForce(ycomponent, 0, xcomponent, ForceMode.VelocityChange);

                    gui.GetComponent <GuiController>().setLatestHit(e.Command.ChatMessage.Username + ": " + angle + " degrees, " + force + " power");
                    gui.GetComponent <GuiController>().addHitCount();
                }
            }
            break;

        default:
            _client.SendMessage(e.Command.ChatMessage.Channel, $"Unknown chat command: {e.Command.CommandIdentifier}{e.Command.CommandText}");
            break;
        }
    }
Exemplo n.º 14
0
        private static void OnChatCommandReceived(object sender, TwitchLib.Client.Events.OnChatCommandReceivedArgs e)
        {
            log("Command " + e.Command.CommandText);

            if (e.Command.ChatMessage.IsBroadcaster || e.Command.ChatMessage.IsModerator)
            {
                switch (e.Command.CommandText)
                {
                case "add":
                    log("Add: " + e.Command.ArgumentsAsString);
                    AddRequest(e.Command.ArgumentsAsList);
                    break;

                case "top":
                    log("Top: " + e.Command.ArgumentsAsString);
                    QueueNext(e.Command.ArgumentsAsList);
                    break;

                case "remove":
                    log("Remove: " + e.Command.ArgumentsAsString);
                    RemoveRequest(e.Command.ArgumentsAsList);
                    break;

                case "enable":
                    SetCommand(true, e.Command.ArgumentsAsList);
                    break;

                case "disable":
                    SetCommand(false, e.Command.ArgumentsAsList);
                    break;

                default:
                    break;
                }
            }


            switch (e.Command.CommandText)
            {
            case "Colour":
            case "colour":
            case "Color":
            case "color":
                if (settings.colorEnabled)
                {
                    ColorCommand(settings.colorDuration, e.Command.ChatMessage.Username);
                }
                else
                {
                    SendChatMessage("Command disabled");
                }
                break;

            case "Queue":
            case "queue":
                PrintQueue();
                break;

            case "Speed":
            case "speed":
                if (settings.speedEnabled)
                {
                    SpeedCommand(settings.speedValue, settings.speedDuration, e.Command.ChatMessage.Username);
                }
                else
                {
                    SendChatMessage("Command disabled");
                }
                break;

            case "Superspeed":
            case "SuperSpeed":
            case "superspeed":
                if (settings.superspeedEnabled)
                {
                    SpeedCommand(settings.superspeedValue, settings.superspeedDuration, e.Command.ChatMessage.Username);
                }
                else
                {
                    SendChatMessage("Command disabled");
                }
                break;

            case "Timewarp":
            case "TimeWarp":
            case "timewarp":
                if (settings.timewarpEnabled)
                {
                    SpeedCommand(settings.timewarpValue, settings.timewarpDuration, e.Command.ChatMessage.Username);
                }
                else
                {
                    SendChatMessage("Command disabled");
                }
                break;

            case "SRR":
            case "srr":
                if (settings.queueEnabled)
                {
                    log("Request: " + e.Command.ArgumentsAsString);
                    AddRequest(e.Command.ArgumentsAsList);
                }
                else
                {
                    SendChatMessage("Queue closed");
                }

                break;

            default:
                break;
            }
        }