コード例 #1
0
 public void GetEmbeddedResults()
 {
     Assert.IsNotNull(RedditService.GetEmbeddedResults("AskReddit", RedditCategory.Hot));
     Assert.IsNotNull(RedditService.GetEmbeddedResults("AskReddit", RedditCategory.New));
     Assert.IsNotNull(RedditService.GetEmbeddedResults("AskReddit", RedditCategory.Top));
     Assert.IsTrue(RedditService.GetEmbeddedResults("AskDinosaurs", RedditCategory.Hot).Description.Contains(":warning:"));
     Assert.IsTrue(RedditService.GetEmbeddedResults("AskDinosaurs", RedditCategory.New).Description.Contains(":warning:"));
     Assert.IsTrue(RedditService.GetEmbeddedResults("AskDinosaurs", RedditCategory.Top).Description.Contains(":warning:"));
 }
コード例 #2
0
 private async Task RedditPost(CommandContext ctx, string query, RedditCategory category)
 {
     if (!BotServices.CheckUserInput(query))
     {
         return;
     }
     var results = RedditService.GetEmbeddedResults(query, category);
     await ctx.RespondAsync("Search results for r/" + query, embed : results).ConfigureAwait(false);
 }