Example #1
0
        // Replaces dynamic variables in command or command return strings
        private static List <string> processDynamicVariables(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e, Objects.ChatCommand command)
        {
            if (e.ArgumentsAsList.Count >= (command.ArgsAsList.Count + 1))
            {
                return(new List <string>());
            }
            List <string> returnMessages = command.ReturnMessages.ToList();

            for (int i = 0; i < returnMessages.Count; i++)
            {
                returnMessages[i] = returnMessages[i].Replace("{sender}", Variables.SENDER(e));
                returnMessages[i] = returnMessages[i].Replace("{recent_sub_name}", Variables.RECENT_SUB_NAME());
                returnMessages[i] = returnMessages[i].Replace("{recent_sub_length}", Variables.RECENT_SUB_LENGTH());
                returnMessages[i] = returnMessages[i].Replace("{stream_game}", Variables.STREAM_GAME());
                returnMessages[i] = returnMessages[i].Replace("{stream_link}", Variables.STREAM_LINK());
                returnMessages[i] = returnMessages[i].Replace("{stream_status}", Variables.STREAM_STATUS());
                returnMessages[i] = returnMessages[i].Replace("{viewer_count}", Variables.VIEWER_COUNT());
                returnMessages[i] = returnMessages[i].Replace("{command_count}", Variables.COMMAND_COUNT());
                returnMessages[i] = returnMessages[i].Replace("{rotating_message_count}", Variables.ROTATING_MESSAGE_COUNT());
                returnMessages[i] = returnMessages[i].Replace("{online_status}", Variables.ONLINE_STATUS());
                returnMessages[i] = returnMessages[i].Replace("{raffle_name}", Variables.RAFFLE_NAME());
                returnMessages[i] = returnMessages[i].Replace("{raffle_donator}", Variables.RAFFLE_DONATOR());
                returnMessages[i] = returnMessages[i].Replace("{raffle_author}", Variables.RAFFLE_AUTHOR());

                if (e.ArgumentsAsList.Count > 0)
                {
                    int currentReplace = 0;
                    foreach (string arg in e.ArgumentsAsList)
                    {
                        returnMessages[i] = returnMessages[i].Replace(command.ArgsAsList[currentReplace], e.ArgumentsAsList[currentReplace]);
                        currentReplace++;
                    }
                }
            }

            return(returnMessages);
        }
Example #2
0
        // Determine if command received's UserTier meets command UserTier in descending fashion
        private static bool validateTiers(TwitchLib.TwitchChatClient.OnCommandReceivedArgs e, Objects.ChatCommand command)
        {
            switch (command.UserTier)
            {
            case Objects.ChatCommand.uTier.SWIFTYSPIFFY:
                if (e.ChatMessage.Username.ToLower() == "swiftyspiffy")
                {
                    return(true);
                }
                return(false);

            case Objects.ChatCommand.uTier.MODERATOR:
                if (Common.isMod(e))
                {
                    return(true);
                }
                return(false);

            case Objects.ChatCommand.uTier.SUBSCRIBER:
                if (Common.isSub(e))
                {
                    return(true);
                }
                return(false);

            case Objects.ChatCommand.uTier.VIEWER:
                return(true);

            case Objects.ChatCommand.uTier.DISABLED:
                return(false);

            default:
                return(true);
            }
        }