Skip to content

Latest commit

 

History

History
36 lines (20 loc) · 868 Bytes

Link to SelfPost.md

File metadata and controls

36 lines (20 loc) · 868 Bytes

Create a Link Post that Points to a Self Post

Author

Kris Craig

Required libraries

Overview

Posts a link to the week's top post on r/AskReddit. Note that all posts on that sub are self posts.

Library Installation

In the NuGet Package Manager console:

Install-Package Reddit

The Code

using Reddit;

...

var reddit = new RedditClient("YourRedditAppID", "YourBotUserRefreshToken");

// Retrieve the SelfPost we want and link to it on r/MySub.  The host will automatically be replaced with np.reddit.com and r/AskReddit will be credited in the title.  --Kris
var newLinkPost = reddit.Subreddit("AskReddit").Posts.GetTop(t: "week")[0].XPostToAsLink("MySub");

Source File

Link to SelfPost.cs