public ScorpBotCommand(string command, string text)
            : this()
        {
            this.Command = command;
            this.Command = this.Command.ToLower();
            this.Command = this.Command.Replace("!", "");

            this.Text = SpecialIdentifierStringBuilder.ConvertScorpBotText(text);

            this.GetRegexEntries(SFXRegexHeaderPattern, (string entry) =>
            {
                this.Actions.Add(new SoundAction(entry, 100));
                return(string.Empty);
            });

            int webRequestCount = 1;

            this.GetRegexEntries(ReadAPIRegexHeaderPattern, (string entry) =>
            {
                string si = "webrequest" + webRequestCount;
                this.Actions.Add(WebRequestAction.CreateForSpecialIdentifier(entry, si));
                webRequestCount++;
                return("$" + si);
            });

            this.Actions.Add(new ChatAction(this.Text));

            this.Requirements.Role.MixerRole = MixerRoleEnum.User;

            this.Enabled = true;
        }
Exemplo n.º 2
0
        public ScorpBotTimer(DbDataReader reader)
        {
            this.Name = (string)reader["Name2"];

            this.Text = (string)reader["Response"];
            this.Text = SpecialIdentifierStringBuilder.ConvertScorpBotText(this.Text);

            this.Enabled = (((int)reader["Enabled"]) == 1);
        }
        public ScorpBotTimerModel(Dictionary <string, object> data)
        {
            this.Name = (string)data["Name2"];

            this.Text = (string)data["Response"];
            this.Text = SpecialIdentifierStringBuilder.ConvertScorpBotText(this.Text);

            this.Enabled = (((int)data["Enabled"]) == 1);
        }
Exemplo n.º 4
0
        public ScorpBotCommand(string command, string text)
        {
            this.Command = command;
            this.Command = this.Command.ToLower();
            this.Command = this.Command.Replace("!", "");

            this.Text = text;
            this.Text = SpecialIdentifierStringBuilder.ConvertScorpBotText(this.Text);

            this.Permission = UserRole.User;

            this.Enabled = true;
        }
Exemplo n.º 5
0
        public void ProcessData(CurrencyModel currency, CurrencyModel rank)
        {
            this.Text = SpecialIdentifierStringBuilder.ConvertScorpBotText(this.Text);

            this.Text = this.GetRegexEntries(this.Text, SFXRegexHeaderPattern, (string entry) =>
            {
                this.Actions.Add(new SoundAction(entry, 100));
                return(string.Empty);
            });

            int webRequestCount = 1;

            this.Text = this.GetRegexEntries(this.Text, ReadAPIRegexHeaderPattern, (string entry) =>
            {
                string si = "webrequest" + webRequestCount;
                this.Actions.Add(WebRequestAction.CreateForSpecialIdentifier(entry, si));
                webRequestCount++;
                return("$" + si);
            });

            if (this.Text.Contains("$toppoints("))
            {
                this.Text = SpecialIdentifierStringBuilder.ReplaceParameterVariablesEntries(this.Text, "$toppoints(", "$top", rank.SpecialIdentifier);
            }

            this.Text = this.Text.Replace("$points", "$" + rank.UserAmountSpecialIdentifier);
            this.Text = this.Text.Replace("$rank", "$" + rank.UserRankNameSpecialIdentifier);

            int readCount = 1;

            this.Text = this.GetRegexEntries(this.Text, ReadFileRegexHeaderPattern, (string entry) =>
            {
                string si = "read" + readCount;

                string[] splits   = entry.Split(new char[] { ',' });
                FileAction action = new FileAction(FileActionTypeEnum.ReadSpecificLineFromFile, si, splits[0]);
                if (splits.Length > 1)
                {
                    action.FileActionType = FileActionTypeEnum.ReadSpecificLineFromFile;
                    if (splits[1].Equals("first"))
                    {
                        action.LineIndexToRead = "1";
                    }
                    else if (splits[1].Equals("random"))
                    {
                        action.FileActionType = FileActionTypeEnum.ReadRandomLineFromFile;
                    }
                    else
                    {
                        action.LineIndexToRead = splits[1];
                    }
                }
                this.Actions.Add(action);

                readCount++;
                return("$" + si);
            });

            this.Text = this.GetRegexEntries(this.Text, WriteFileRegexHeaderPattern, (string entry) =>
            {
                string[] splits = entry.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                if (splits.Length == 1)
                {
                    this.Actions.Add(new FileAction(FileActionTypeEnum.AppendToFile, string.Empty, splits[0]));
                }
                else if (splits.Length == 2)
                {
                    this.Actions.Add(new FileAction(FileActionTypeEnum.AppendToFile, splits[1], splits[0]));
                }
                else if (splits.Length > 2)
                {
                    FileAction action = new FileAction(FileActionTypeEnum.AppendToFile, splits[1], splits[0]);
                    if (bool.TryParse(splits[2], out bool overwrite) && overwrite)
                    {
                        action.FileActionType = FileActionTypeEnum.SaveToFile;
                    }
                    this.Actions.Add(action);
                }
                return(string.Empty);
            });

            this.Actions.Add(new ChatAction(this.Text));
        }