private SlackResponse GetSlackResponse(ChromaStyle style)
 {
     return new SlackResponse
     {
         response_type = "in_channel",
         text = "Oh, lovely! I'm sure it will be appreciated. Here's what you sent:",
         attachments = style.Commands.Select(command => new SlackAttachment
         {
             text = command.ToString(),
             color = $"#{command.Color.R:x2}{command.Color.G:x2}{command.Color.B:x2}"
         }).ToArray()
     };
 }
Example #2
0
        public ChromaStyle Parse(string rawCommand)
        {
            var style = new ChromaStyle();
            var separator = new[] {" THEN "};
            var stringCommands = rawCommand.ToUpper().Split(separator, StringSplitOptions.RemoveEmptyEntries);

            var commands = new List<StyleCommand>();
            foreach (var stringCommand in stringCommands)
            {
                var commandParts = stringCommand.Split(' ');
                commands.Add(CreateStyleFromParts(commandParts));
            }
            style.Commands = commands.ToArray();
            return style;
        }