Example #1
0
        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!");
            }
        }
Example #2
0
        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!");
            }
        }