示例#1
0
 public BotMessage GetResponse(ResponseContext context)
 {
     if (SaveAnswer(context.Message))
     {
         chatApi.PostMessage(ConfigurationManager.AppSettings["SlackBotApiToken"], context.Message.User.ID, "Your reply has been posted. Thank you for the input");
         return(new BotMessage());
     }
     chatApi.PostMessage(ConfigurationManager.AppSettings["SlackBotApiToken"], context.Message.User.ID, "There was an error posting your question.");
     return(new BotMessage());
 }
        public BotMessage GetResponse(ResponseContext context)
        {
            var builder = new StringBuilder();

            builder.Append("Can someone please help ");
            builder.Append(context.Message.User.FormattedUserID);
            builder.Append("? Thanks :)");
            if (SaveQuestion(context.Message))
            {
                chatApi.PostMessage(ConfigurationManager.AppSettings["SlackBotApiToken"], context.Message.User.ID, "Your Question has been posted.");
                return(new BotMessage());
            }

            //If there are errors
            chatApi.PostMessage(ConfigurationManager.AppSettings["SlackBotApiToken"], context.Message.User.ID, "There was an error posting your question. Please contact the Administrator");
            return(new BotMessage());
        }
示例#3
0
        public async Task TestAsync(Payload request)
        {
            var response = await _chat.PostMessage(request);

            _logger.LogInformation("\nRequest:\n{Request}\n" +
                                   "\nResult:\n{Result}\n",
                                   request.ToJson(Formatting.Indented),
                                   response.ToJson(Formatting.Indented));
        }