Example #1
0
        public async Task <List <object> > ConvertChainCommandsToObjects(SocketUserMessage e, List <object> input, int depth)
        {
            List <object> converted = new List <object> ();

            foreach (object obj in input)
            {
                object result    = obj;
                string stringObj = obj.ToString();

                if (stringObj.Length > 0)
                {
                    if (stringObj [0].IsTrigger())
                    {
                        Program.FoundCommandResult foundCommandResult = await Program.FindAndExecuteCommand(e, stringObj, Program.commands, depth + 1, false, true);

                        if (foundCommandResult.result != null)
                        {
                            result = foundCommandResult.result.value;
                        }
                    }
                    else if (stringObj [0] == '{')
                    {
                        int endIndex = stringObj.IndexOf('}');
                        if (endIndex != -1)
                        {
                            string varName = stringObj.Substring(1, endIndex - 1);
                            result = CommandVariables.Get(e.Id, varName);
                        }
                    }
                    else if (stringObj [0] == '<')
                    {
                        IMentionable mentionable = Utility.ConvertMentionToObject(stringObj);
                        result = mentionable;
                    }
                }

                converted.Add(result);
            }

            return(converted);
        }
 public Task <Result> Execute(SocketUserMessage e, string name)
 {
     return(TaskResult(CommandVariables.Get(0, name), ""));
 }