Skip to content

Latest commit

 

History

History
42 lines (24 loc) · 908 Bytes

Update Client Prefs.md

File metadata and controls

42 lines (24 loc) · 908 Bytes

Update Client Prefs

Author

Kris Craig

Required libraries

Overview

Updates the authenticated user's preferences to allow viewing of NSFW content.

Library Installation

In the NuGet Package Manager console:

Install-Package Reddit

The Code

using Reddit;

...

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

// Retrieve the current account preferences.  --Kris
var prefs = reddit.Account.Prefs();

// Modify our local copy of the preferences by setting the Over18 property to true.  --Kris
prefs.Over18 = true;

// Send our modified preferences instance back to the Reddit API.  --Kris
reddit.Account.UpdatePrefs(new AccountPrefsSubmit(prefs, null, false, null));

Source File

Update Client Prefs.cs