private static async Task <HandleIntentResult> HandleIntentAsync(string intent) { switch (intent) { case "HelloIntent": return(new HandleIntentResult { ResponseMessage = HelloMessage }); case "AskLatestBlogTitleIntent": { var chomadoBlogService = new ChomadoBlogService(); var blog = await chomadoBlogService.GetLatestBlogAsync(); if (blog != null) { return(new HandleIntentResult { ResponseMessage = $"ちょまどさんのブログの最新記事は {blog.Title} です。", Blog = blog, }); } else { return(new HandleIntentResult { ResponseMessage = "ちょまどさんのブログの最新記事は、わかりませんでした。", }); } } default: return(new HandleIntentResult { ResponseMessage = ErrorMessage, }); } }
public BlogAssistant(ChomadoBlogService service, ILineMessagingClient messagingClient) { Service = service; MessagingClient = messagingClient; }
static void Main(string[] args) { var s = new ChomadoBlogService(); Console.WriteLine(s.GetNewestBlogTitleAsync().Result); }