Пример #1
0
 static void Main(string[] args)
 {
     try
     {
         //DON"T CALL AGAIN
         //SetUpRepository.Run("Bless.GitApiTest2").GetAwaiter().GetResult();
         SetUpRepository.Run("RetailSuccess.SlackGitIntegration3", "CoolTestOrganization", "Retail Success").GetAwaiter()
         .GetResult();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Пример #2
0
        /*
         * /// <summary>
         * /// A simple function that takes a string and takes the values.
         * /// </summary>
         * /// <param name="t"></param>
         * /// <param name="context"></param>
         * /// <returns></returns>
         * public string FunctionHandler(SlashCommand t, ILambdaContext context)
         * {//I did use JObject t with the foreach.
         *  var y = "values: ";
         *  //foreach (var x in t) {y += x.Value;}
         *  y += "and now: " + t.Text + t.UserName;
         *  return y;
         * }
         */


        /// <summary>
        /// A simple function that takes a string and takes the values.
        /// </summary>
        /// <param name="slCom"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public async Task FunctionHandler(SlashCommand slCom, ILambdaContext context)
        {
            if (slCom == null)
            {
                return;
            }
            if (slCom.Token != "xMZ9mwYeDyNv1uNaxf920JEG")
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(slCom.Text))
            {
                return;
            }
            string c = "Create Repo Command Sent. ";

            try
            {
                var repoParams = slCom.Text.Split(' ');
                switch (repoParams.Length)
                {
                case 4:
                    SetUpRepository.Run(repoParams[0], repoParams[1], repoParams[2] + " " + repoParams[3]).GetAwaiter().GetResult();
                    break;

                case 3:
                    SetUpRepository.Run(repoParams[0], repoParams[1], repoParams[2]).GetAwaiter().GetResult();
                    break;

                case 2:
                    SetUpRepository.Run(repoParams[0], repoParams[1], "Retail Success").GetAwaiter().GetResult();
                    break;

                default:
                    SetUpRepository.Run(slCom.Text, "CoolTestOrganization", "Retail Success").GetAwaiter().GetResult();
                    break;
                }
            }
            catch (Exception ex)
            {
                await sendSlackReplyAsync(ex.Message, slCom.ResponseUrl);
            }
            await sendSlackReplyAsync(c, slCom.ResponseUrl);
        }