示例#1
0
文件: Reddit.cs 项目: Fjoksch/Cirilla
        public async Task Dankmeme()
        {
            try {
                RedditApi redditService = new RedditApi();
                Subreddit subreddit     = await redditService.GetSubredditAsync("dankmemes");

                RedditNet.Things.Link link = await subreddit.GetRandomLinkAsync();
                await ReplyAsync(link.Title + " - " + link.Url);
            } catch {
                await ReplyAsync("Sorry, I couldn't find a dank enough post!");
            }
        }
示例#2
0
文件: Reddit.cs 项目: Fjoksch/Cirilla
        public async Task RandomPost([Summary("The subreddit to look for a random post")] string rsubreddit)
        {
            try {
                string filtered = Regex.Replace(rsubreddit, "/?r/", "");

                RedditApi redditService = new RedditApi();
                Subreddit subreddit     = await redditService.GetSubredditAsync(filtered);

                RedditNet.Things.Link link = await subreddit.GetRandomLinkAsync();
                await ReplyAsync(link.Title + " - " + link.Url);
            } catch {
                await ReplyAsync("Sorry, I couldn't find a random post in that subreddit!");
            }
        }