Example #1
5
 static void Main(string[] args)
 {
     var reddit = new Reddit();
     int backDays;
     try
     {
         reddit.User = reddit.LogIn(ModUserName, ModPassword);
         _sub = reddit.GetSubreddit(SubReddit);
         int.TryParse(ReadBackDays, out backDays);
         if(backDays<1)
         {
             Console.WriteLine("Invalid value for readBackDays in config file. Please enter an integer greater than 0.");
             throw new Exception();
         }
     }
     catch
     {
         Console.WriteLine("Configuration Error. Please confirm values in config file.");
         Console.WriteLine("Press Enter to exit.");
         Console.Read();
         return;
     }
     while (true)
     {
         try
         {
             AssignFlairs(TriggerText, DateTime.Today.AddDays(backDays));
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex.Message);
         }
     }
 }
 public SubredditSettings(Subreddit subreddit, Reddit reddit, JObject json)
 {
     Subreddit = subreddit;
     Reddit = reddit;
     var data = json["data"];
     AllowAsDefault = data["default_set"].Value<bool>();
     Domain = data["domain"].Value<string>();
     Description = data["description"].Value<string>();
     Language = data["language"].Value<string>();
     Title = data["title"].Value<string>();
     WikiEditKarma = data["wiki_edit_karma"].Value<int>();
     UseDomainCss = data["domain_css"].Value<bool>();
     UseDomainSidebar = data["domain_sidebar"].Value<bool>();
     HeaderHoverText = data["header_hover_text"].Value<string>();
     NSFW = data["over_18"].Value<bool>();
     PublicDescription = data["public_description"].Value<string>();
     string wikiMode = data["wikimode"].Value<string>();
     switch (wikiMode)
     {
         case "disabled":
             WikiEditMode = WikiEditMode.None;
             break;
         case "modonly":
             WikiEditMode = WikiEditMode.Moderators;
             break;
         case "anyone":
             WikiEditMode = WikiEditMode.All;
             break;
     }
     string type = data["subreddit_type"].Value<string>();
     switch (type)
     {
         case "public":
             SubredditType = SubredditType.Public;
             break;
         case "private":
             SubredditType = SubredditType.Private;
             break;
         case "restricted":
             SubredditType = SubredditType.Restricted;
             break;
     }
     ShowThumbnails = data["show_media"].Value<bool>();
     WikiEditAge = data["wiki_edit_age"].Value<int>();
     string contentOptions = data["content_options"].Value<string>();
     switch (contentOptions)
     {
         case "any":
             ContentOptions = ContentOptions.All;
             break;
         case "link":
             ContentOptions = ContentOptions.LinkOnly;
             break;
         case "self":
             ContentOptions = ContentOptions.SelfOnly;
             break;
     }
 }
 public SubredditStyle(Reddit reddit, Subreddit subreddit, JToken json, IWebAgent webAgent)
     : this(reddit, subreddit, webAgent)
 {
     Images = new List<SubredditImage>();
     var data = json["data"];
     CSS = HttpUtility.HtmlDecode(data["stylesheet"].Value<string>());
     foreach (var image in data["images"])
     {
         Images.Add(new SubredditImage(
             Reddit, this, image["link"].Value<string>(),
             image["name"].Value<string>(), image["url"].Value<string>(), WebAgent));
     }
 }
        public static Subreddit GetRSlashAll(Reddit reddit)
        {
            var rSlashAll = new Subreddit
            {
                DisplayName = "/r/all",
                Title       = "/r/all",
                Url         = new Uri("/r/all", UriKind.Relative),
                Name        = "all",
                Reddit      = reddit,
                WebAgent    = reddit._webAgent
            };

            return(rSlashAll);
        }
        public static Subreddit GetFrontPage(Reddit reddit)
        {
            var frontPage = new Subreddit
            {
                DisplayName = "Front Page",
                Title       = "reddit: the front page of the internet",
                Url         = new Uri("/", UriKind.Relative),
                Name        = "/",
                Reddit      = reddit,
                WebAgent    = reddit._webAgent
            };

            return(frontPage);
        }
 public SubredditStyle(Reddit reddit, Subreddit subreddit, JToken json)
 {
     Reddit = reddit;
     Subreddit = subreddit;
     Images = new List<SubredditImage>();
     var data = json["data"];
     CSS = data["stylesheet"].Value<string>();
     foreach (var image in data["images"])
     {
         Images.Add(new SubredditImage(
             Reddit, this, image["link"].Value<string>(),
             image["name"].Value<string>(), image["url"].Value<string>()));
     }
 }
Example #7
0
 public SubredditSettings(Reddit reddit, Subreddit subreddit)
 {
     Subreddit = subreddit;
     Reddit    = reddit;
     // Default settings, for use when reduced information is given
     AllowAsDefault    = true;
     Domain            = null;
     Sidebar           = string.Empty;
     Language          = "en";
     Title             = Subreddit.DisplayName;
     WikiEditKarma     = 100;
     WikiEditAge       = 10;
     UseDomainCss      = false;
     UseDomainSidebar  = false;
     HeaderHoverText   = string.Empty;
     NSFW              = false;
     PublicDescription = string.Empty;
     WikiEditMode      = WikiEditMode.None;
     SubredditType     = SubredditType.Public;
     ShowThumbnails    = true;
     ContentOptions    = ContentOptions.All;
 }
 public SubredditSettings(Reddit reddit, Subreddit subreddit)
 {
     Subreddit = subreddit;
     Reddit = reddit;
     // Default settings, for use when reduced information is given
     AllowAsDefault = true;
     Domain = null;
     Sidebar = string.Empty;
     Language = "en";
     Title = Subreddit.DisplayName;
     WikiEditKarma = 100;
     WikiEditAge = 10;
     UseDomainCss = false;
     UseDomainSidebar = false;
     HeaderHoverText = string.Empty;
     NSFW = false;
     PublicDescription = string.Empty;
     WikiEditMode = WikiEditMode.None;
     SubredditType = SubredditType.Public;
     ShowThumbnails = true;
     ContentOptions = ContentOptions.All;
 }
Example #9
0
        static void Init()
        {
            Console.ForegroundColor = ConsoleColor.Gray;
            Console.WriteLine("ScreenshotBot is bootstrapping...");

            try
            {
                reddit = new Reddit();
                Reddit.UserAgent = "ScreenshotBot";
                ini = new IniFile("sst.ini");
                reddit.LogIn(ini.IniReadValue("ACCOUNT", "Username"), ini.IniReadValue("ACCOUNT", "Password"));
                var inisub = ini.IniReadValue("BOT", "Subreddit");
                if (inisub == "all") sub = Subreddit.GetRSlashAll(reddit);
                else sub = reddit.GetSubreddit(inisub);
                popular = new BlackList("popular", ini);
                www = ini.IniReadValue("BOT", "www");
                template = ini.IniReadValue("BOT", "Template");

                Work1 = new List<Post>();
                Work2 = new List<Post>();
                ProcessedURLs = new List<string>();

                ThreadPool.QueueUserWorkItem(new WaitCallback(ScreenshotWorker), 1);
                ThreadPool.QueueUserWorkItem(new WaitCallback(ScreenshotWorker), 2);

            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Initialization failure! Error details: \r\n" + ex.ToString());
                Console.ReadLine();
                return;
            }

            Console.WriteLine("ScreenshotBot was successfully initialized!\n----------------------------------------------------------\r\n\r\n");
        }
Example #10
0
 protected internal Wiki(Reddit reddit, Subreddit subreddit, IWebAgent webAgent)
 {
     Reddit = reddit;
     Subreddit = subreddit;
     WebAgent = webAgent;
 }
Example #11
0
 public SubredditStyle(Subreddit subreddit) : base(subreddit?.WebAgent)
 {
     Subreddit = subreddit;
 }
 public SubredditStyle(Reddit reddit, Subreddit subreddit, IWebAgent webAgent)
 {
     Reddit = reddit;
     Subreddit = subreddit;
     WebAgent = webAgent;
 }
Example #13
0
 public SubredditStyle(Reddit reddit, Subreddit subreddit)
 {
     Reddit = reddit;
     Subreddit = subreddit;
 }
Example #14
0
 protected internal Wiki(Reddit reddit, Subreddit subreddit, IWebAgent webAgent)
 {
     Reddit    = reddit;
     Subreddit = subreddit;
     WebAgent  = webAgent;
 }
 public static void pullTitlesTo(Subreddit sub, int n, StreamWriter destination)
 {
     foreach (var post in pullNFrom(sub, n)) printTitleToFile(destination)(post);
 }
        // From Single Subreddit

        public static List<Post> pullNFrom(Subreddit sub, int n)
        {
            return sub.Hot.Take(n).ToList();
        }
Example #17
0
        public SubredditSettings(Subreddit subreddit, Reddit reddit, JObject json, IWebAgent webAgent) : this(reddit, subreddit, webAgent)
        {
            var data = json["data"];

            AllowAsDefault          = data["default_set"].ValueOrDefault <bool>();
            Domain                  = data["domain"].ValueOrDefault <string>();
            Sidebar                 = HttpUtility.HtmlDecode(data["description"].ValueOrDefault <string>() ?? string.Empty);
            Language                = data["language"].ValueOrDefault <string>();
            Title                   = data["title"].ValueOrDefault <string>();
            SubmitText              = data["submit_text"].ValueOrDefault <string>();
            SubmitLinkLabel         = data["submit_link_label"].ValueOrDefault <string>();
            SubmitTextLabel         = data["submit_text_label"].ValueOrDefault <string>();
            CollapseDeletedComments = data["collapse_deleted_comments"].ValueOrDefault <bool>();
            ExcludeBannedModqueue   = data["exclude_banned_modqueue"].ValueOrDefault <bool>();
            WikiEditKarma           = data["wiki_edit_karma"].ValueOrDefault <int>();
            HideAds                 = data["hide_ads"].ValueOrDefault <bool>();
            IsTrafficPublic         = data["public_traffic"].ValueOrDefault <bool>();
            UseDomainCss            = data["domain_css"].ValueOrDefault <bool>();
            UseDomainSidebar        = data["domain_sidebar"].ValueOrDefault <bool>();
            HeaderHoverText         = data["header_hover_text"].ValueOrDefault <string>();
            NSFW = data["over_18"].ValueOrDefault <bool>();
            PublicDescription = HttpUtility.HtmlDecode(data["public_description"].ValueOrDefault <string>() ?? string.Empty);
            SpamFilter        = new SpamFilterSettings
            {
                LinkPostStrength = GetSpamFilterStrength(data["spam_links"].ValueOrDefault <string>()),
                SelfPostStrength = GetSpamFilterStrength(data["spam_selfposts"].ValueOrDefault <string>()),
                CommentStrength  = GetSpamFilterStrength(data["spam_comments"].ValueOrDefault <string>())
            };
            if (data["wikimode"] != null)
            {
                var wikiMode = data["wikimode"].ValueOrDefault <string>();
                switch (wikiMode)
                {
                case "disabled":
                    WikiEditMode = WikiEditMode.None;
                    break;

                case "modonly":
                    WikiEditMode = WikiEditMode.Moderators;
                    break;

                case "anyone":
                    WikiEditMode = WikiEditMode.All;
                    break;
                }
            }
            if (data["subreddit_type"] != null)
            {
                var type = data["subreddit_type"].ValueOrDefault <string>();
                switch (type)
                {
                case "public":
                    SubredditType = SubredditType.Public;
                    break;

                case "private":
                    SubredditType = SubredditType.Private;
                    break;

                case "restricted":
                    SubredditType = SubredditType.Restricted;
                    break;

                case "gold_restricted":
                    SubredditType = SubredditType.GoldRestricted;
                    break;

                case "archived":
                    SubredditType = SubredditType.Archived;
                    break;

                case "gold_only":
                    SubredditType = SubredditType.GoldOnly;
                    break;

                case "employees_only":
                    SubredditType = SubredditType.EmployeesOnly;
                    break;
                }
            }
            ShowThumbnails             = data["show_media"].ValueOrDefault <bool>();
            ShowMediaPreviews          = data["show_media_preview"].ValueOrDefault <bool>();
            AllowImages                = data["allow_images"].ValueOrDefault <bool>();
            MinutesToHideCommentScores = data["comment_score_hide_mins"].ValueOrDefault <int>();
            WikiEditAge                = data["wiki_edit_age"].ValueOrDefault <int>();
            if (data["content_options"] != null)
            {
                var contentOptions = data["content_options"].ValueOrDefault <string>();
                switch (contentOptions)
                {
                case "any":
                    ContentOptions = ContentOptions.All;
                    break;

                case "link":
                    ContentOptions = ContentOptions.LinkOnly;
                    break;

                case "self":
                    ContentOptions = ContentOptions.SelfOnly;
                    break;
                }
            }
            if (data["suggested_comment_sort"] != null)
            {
                var suggestedCommentSort = data["suggested_comment_sort"].ValueOrDefault <string>();
                switch (suggestedCommentSort)
                {
                case "confidence":
                    SuggestedCommentSort = CommentSorts.Confidence;
                    break;

                case "top":
                    SuggestedCommentSort = CommentSorts.Top;
                    break;

                case "new":
                    SuggestedCommentSort = CommentSorts.New;
                    break;

                case "controversial":
                    SuggestedCommentSort = CommentSorts.Controversial;
                    break;

                case "old":
                    SuggestedCommentSort = CommentSorts.Old;
                    break;

                case "random":
                    SuggestedCommentSort = CommentSorts.Random;
                    break;

                case "qa":
                    SuggestedCommentSort = CommentSorts.Qa;
                    break;
                }
            }
        }
 public SubredditSettings(Subreddit subreddit, Reddit reddit, JObject json, IWebAgent webAgent)
     : this(reddit, subreddit, webAgent)
 {
     var data = json["data"];
     AllowAsDefault = data["default_set"].ValueOrDefault<bool>();
     Domain = data["domain"].ValueOrDefault<string>();
     Sidebar = HttpUtility.HtmlDecode(data["description"].ValueOrDefault<string>() ?? string.Empty);
     Language = data["language"].ValueOrDefault<string>();
     Title = data["title"].ValueOrDefault<string>();
     WikiEditKarma = data["wiki_edit_karma"].ValueOrDefault<int>();
     UseDomainCss = data["domain_css"].ValueOrDefault<bool>();
     UseDomainSidebar = data["domain_sidebar"].ValueOrDefault<bool>();
     HeaderHoverText = data["header_hover_text"].ValueOrDefault<string>();
     NSFW = data["over_18"].ValueOrDefault<bool>();
     PublicDescription = HttpUtility.HtmlDecode(data["public_description"].ValueOrDefault<string>() ?? string.Empty);
     if (data["wikimode"] != null)
     {
         var wikiMode = data["wikimode"].ValueOrDefault<string>();
         switch (wikiMode)
         {
             case "disabled":
                 WikiEditMode = WikiEditMode.None;
                 break;
             case "modonly":
                 WikiEditMode = WikiEditMode.Moderators;
                 break;
             case "anyone":
                 WikiEditMode = WikiEditMode.All;
                 break;
         }
     }
     if (data["subreddit_type"] != null)
     {
         var type = data["subreddit_type"].ValueOrDefault<string>();
         switch (type)
         {
             case "public":
                 SubredditType = SubredditType.Public;
                 break;
             case "private":
                 SubredditType = SubredditType.Private;
                 break;
             case "restricted":
                 SubredditType = SubredditType.Restricted;
                 break;
         }
     }
     ShowThumbnails = data["show_media"].ValueOrDefault<bool>();
     WikiEditAge = data["wiki_edit_age"].ValueOrDefault<int>();
     if (data["content_options"] != null)
     {
         var contentOptions = data["content_options"].ValueOrDefault<string>();
         switch (contentOptions)
         {
             case "any":
                 ContentOptions = ContentOptions.All;
                 break;
             case "link":
                 ContentOptions = ContentOptions.LinkOnly;
                 break;
             case "self":
                 ContentOptions = ContentOptions.SelfOnly;
                 break;
         }
     }
 }
        /// <summary>
        /// Get the subreddit settings page.
        /// </summary>
        /// <param name="subreddit">A subreddit.</param>
        /// <param name="json"></param>
        public SubredditSettings(Subreddit subreddit, JToken json) : this(subreddit)
        {
            var data = json["data"];
            AllowAsDefault    = data["default_set"].ValueOrDefault <bool>();
            AllowImages       = data["allow_images"].ValueOrDefault <bool>();
            Domain            = data["domain"].ValueOrDefault <string>();
            Sidebar           = WebUtility.HtmlDecode(data["description"].ValueOrDefault <string>() ?? string.Empty);
            Language          = data["language"].ValueOrDefault <string>();
            Title             = data["title"].ValueOrDefault <string>();
            WikiEditKarma     = data["wiki_edit_karma"].ValueOrDefault <int>();
            UseDomainCss      = data["domain_css"].ValueOrDefault <bool>();
            UseDomainSidebar  = data["domain_sidebar"].ValueOrDefault <bool>();
            HeaderHoverText   = data["header_hover_text"].ValueOrDefault <string>();
            NSFW              = data["over18"].ValueOrDefault <bool>();
            PublicDescription = WebUtility.HtmlDecode(data["public_description"].ValueOrDefault <string>() ?? string.Empty);
            SpamFilter        = new SpamFilterSettings
            {
                LinkPostStrength = GetSpamFilterStrength(data["spam_links"].ValueOrDefault <string>()),
                SelfPostStrength = GetSpamFilterStrength(data["spam_selfposts"].ValueOrDefault <string>()),
                CommentStrength  = GetSpamFilterStrength(data["spam_comments"].ValueOrDefault <string>())
            };
            if (data["wikimode"] != null)
            {
                var wikiMode = data["wikimode"].ValueOrDefault <string>();
                switch (wikiMode)
                {
                case "disabled":
                    WikiEditMode = WikiEditMode.None;
                    break;

                case "modonly":
                    WikiEditMode = WikiEditMode.Moderators;
                    break;

                case "anyone":
                    WikiEditMode = WikiEditMode.All;
                    break;
                }
            }
            if (data["subreddit_type"] != null)
            {
                var type = data["subreddit_type"].ValueOrDefault <string>();
                switch (type)
                {
                case "public":
                    SubredditType = SubredditType.Public;
                    break;

                case "private":
                    SubredditType = SubredditType.Private;
                    break;

                case "restricted":
                    SubredditType = SubredditType.Restricted;
                    break;
                }
            }
            ShowThumbnails = data["show_media"].ValueOrDefault <bool>();
            WikiEditAge    = data["wiki_edit_age"].ValueOrDefault <int>();
            if (data["content_options"] != null)
            {
                var contentOptions = data["content_options"].ValueOrDefault <string>();
                switch (contentOptions)
                {
                case "any":
                    ContentOptions = ContentOptions.All;
                    break;

                case "link":
                    ContentOptions = ContentOptions.LinkOnly;
                    break;

                case "self":
                    ContentOptions = ContentOptions.SelfOnly;
                    break;
                }
            }
        }
Example #20
0
 public static Subreddit GetFrontPage(Reddit reddit)
 {
     var frontPage = new Subreddit
     {
         DisplayName = "Front Page",
         Title = "reddit: the front page of the internet",
         Url = new Uri("/", UriKind.Relative),
         Name = "/",
         Reddit = reddit,
         WebAgent = reddit._webAgent
     };
     return frontPage;
 }
        protected static void PostRedditThread(Subreddit subreddit, string title, StringBuilder comment)
        {
            Console.WriteLine(LOG_POST_POST);

            subreddit.SubmitTextPost(title, comment.ToString());
        }
 protected static IEnumerable<RedditSharp.Post> GetTopPosts(Subreddit subreddit)
 {
     Console.WriteLine(LOG_GET_POSTS);
     return subreddit.GetHot().Take(TOP_POSTS_TO_GRAB);
 }
Example #23
0
 public static Subreddit GetFrontPage(Reddit reddit)
 {
     var frontPage = new Subreddit
     {
         DisplayName = "Front Page",
         Title = "reddit: the front page of the internet",
         Url = "/",
         Name = "/",
         Reddit = reddit
     };
     return frontPage;
 }
Example #24
0
 public static Subreddit GetRSlashAll(Reddit reddit)
 {
     var rSlashAll = new Subreddit
     {
         DisplayName = "/r/all",
         Title = "/r/all",
         Url = new Uri("/r/all", UriKind.Relative),
         Name = "all",
         Reddit = reddit,
         WebAgent = reddit._webAgent
     };
     return rSlashAll;
 }
Example #25
0
        public SubredditSettings(Subreddit subreddit, Reddit reddit, JObject json)
            : this(reddit, subreddit)
        {
            var data = json["data"];

            AllowAsDefault    = data["default_set"].ValueOrDefault <bool>();
            Domain            = data["domain"].ValueOrDefault <string>();
            Sidebar           = HttpUtility.HtmlDecode(data["description"].ValueOrDefault <string>() ?? string.Empty);
            Language          = data["language"].ValueOrDefault <string>();
            Title             = data["title"].ValueOrDefault <string>();
            WikiEditKarma     = data["wiki_edit_karma"].ValueOrDefault <int>();
            UseDomainCss      = data["domain_css"].ValueOrDefault <bool>();
            UseDomainSidebar  = data["domain_sidebar"].ValueOrDefault <bool>();
            HeaderHoverText   = data["header_hover_text"].ValueOrDefault <string>();
            NSFW              = data["over_18"].ValueOrDefault <bool>();
            PublicDescription = HttpUtility.HtmlDecode(data["public_description"].ValueOrDefault <string>() ?? string.Empty);
            if (data["wikimode"] != null)
            {
                string wikiMode = data["wikimode"].ValueOrDefault <string>();
                switch (wikiMode)
                {
                case "disabled":
                    WikiEditMode = WikiEditMode.None;
                    break;

                case "modonly":
                    WikiEditMode = WikiEditMode.Moderators;
                    break;

                case "anyone":
                    WikiEditMode = WikiEditMode.All;
                    break;
                }
            }
            if (data["subreddit_type"] != null)
            {
                string type = data["subreddit_type"].ValueOrDefault <string>();
                switch (type)
                {
                case "public":
                    SubredditType = SubredditType.Public;
                    break;

                case "private":
                    SubredditType = SubredditType.Private;
                    break;

                case "restricted":
                    SubredditType = SubredditType.Restricted;
                    break;
                }
            }
            ShowThumbnails = data["show_media"].ValueOrDefault <bool>();
            WikiEditAge    = data["wiki_edit_age"].ValueOrDefault <int>();
            if (data["content_options"] != null)
            {
                string contentOptions = data["content_options"].ValueOrDefault <string>();
                switch (contentOptions)
                {
                case "any":
                    ContentOptions = ContentOptions.All;
                    break;

                case "link":
                    ContentOptions = ContentOptions.LinkOnly;
                    break;

                case "self":
                    ContentOptions = ContentOptions.SelfOnly;
                    break;
                }
            }
        }
Example #26
0
 public SubredditStyle(Reddit reddit, Subreddit subreddit)
 {
     Reddit    = reddit;
     Subreddit = subreddit;
 }
 public static Subreddit GetRSlashAll(Reddit reddit)
 {
     var rSlashAll = new Subreddit
     {
         DisplayName = "/r/all",
         Title = "/r/all",
         Url = "/r/all",
         Name = "all",
         Reddit = reddit
     };
     return rSlashAll;
 }
Example #28
0
 public SubredditStyle(Reddit reddit, Subreddit subreddit, IWebAgent webAgent)
 {
     Reddit    = reddit;
     Subreddit = subreddit;
     WebAgent  = webAgent;
 }
        /// <summary>
        /// Get the subreddit settings page.
        /// </summary>
        /// <param name="subreddit">A subreddit.</param>
        /// <param name="json"></param>
        public SubredditSettings(Subreddit subreddit, JToken json) : this(subreddit)
        {
            var data = json["data"];
            AllowAsDefault    = data["default_set"].ValueOrDefault <bool>();
            AllowImages       = data["allow_images"].ValueOrDefault <bool>();
            Domain            = data["domain"].ValueOrDefault <string>();
            Sidebar           = WebUtility.HtmlDecode(data["description"].ValueOrDefault <string>() ?? string.Empty);
            Language          = data["language"].ValueOrDefault <string>();
            Title             = data["title"].ValueOrDefault <string>();
            WikiEditKarma     = data["wiki_edit_karma"].ValueOrDefault <int>();
            UseDomainCss      = data["domain_css"].ValueOrDefault <bool>();
            UseDomainSidebar  = data["domain_sidebar"].ValueOrDefault <bool>();
            HeaderHoverText   = data["header_hover_text"].ValueOrDefault <string>();
            NSFW              = data["over18"].ValueOrDefault <bool>();
            PublicDescription = WebUtility.HtmlDecode(data["public_description"].ValueOrDefault <string>() ?? string.Empty);
            SpamFilter        = new SpamFilterSettings
            {
                LinkPostStrength = GetSpamFilterStrength(data["spam_links"].ValueOrDefault <string>()),
                SelfPostStrength = GetSpamFilterStrength(data["spam_selfposts"].ValueOrDefault <string>()),
                CommentStrength  = GetSpamFilterStrength(data["spam_comments"].ValueOrDefault <string>())
            };

            FreeFormReports           = data["free_form_reports"].ValueOrDefault <bool>();
            SubmitText                = WebUtility.HtmlDecode(data["submit_text"].ValueOrDefault <string>() ?? string.Empty);
            CollapseDeletedComments   = data["collapse_deleted_comments"].ValueOrDefault <bool>();
            AllowVideos               = data["allow_videos"].ValueOrDefault <bool>();
            SpoilersEnabled           = data["spoilers_enabled"].ValueOrDefault <bool>();
            OriginalContentTagEnabled = data["original_content_tag_enabled"].ValueOrDefault <bool>();
            SubmitLinkLabel           = data["submit_link_label"].ValueOrDefault <string>();
            AllowPostCrossposts       = data["allow_post_crossposts"].ValueOrDefault <bool>();
            PublicTraffic             = data["public_traffic"].ValueOrDefault <bool>();
            SubmitTextLabel           = data["submit_text_label"].ValueOrDefault <string>();
            AllOriginalContent        = data["all_original_content"].ValueOrDefault <bool>();
            HideAds               = data["hide_ads"].ValueOrDefault <bool>();
            AllowDiscovery        = data["allow_discovery"].ValueOrDefault <bool>();
            ShowMediaPreview      = data["show_media_preview"].ValueOrDefault <bool>();
            CommentScoreHideMins  = data["comment_score_hide_mins"].ValueOrDefault <int>();
            ExcludeBannedModqueue = data["exclude_banned_modqueue"].ValueOrDefault <bool>();

            if (data["suggested_comment_sort"] != null)
            {
                // one of (confidence, top, new, controversial, old, random, qa, live)
                var suggestedCommentSort = data["suggested_comment_sort"].ValueOrDefault <string>();

                if (!string.IsNullOrEmpty(suggestedCommentSort))
                {
                    switch (suggestedCommentSort)
                    {
                    case "confidence":
                        SuggestedCommentSort = RedditSharp.SuggestedCommentSort.Confidence;
                        break;

                    case "top":
                        SuggestedCommentSort = RedditSharp.SuggestedCommentSort.Top;
                        break;

                    case "new":
                        SuggestedCommentSort = RedditSharp.SuggestedCommentSort.New;
                        break;

                    case "controversial":
                        SuggestedCommentSort = RedditSharp.SuggestedCommentSort.Controversial;
                        break;

                    case "old":
                        SuggestedCommentSort = RedditSharp.SuggestedCommentSort.Old;
                        break;

                    case "random":
                        SuggestedCommentSort = RedditSharp.SuggestedCommentSort.Random;
                        break;

                    case "qa":
                        SuggestedCommentSort = RedditSharp.SuggestedCommentSort.Qa;
                        break;

                    case "live":
                        SuggestedCommentSort = RedditSharp.SuggestedCommentSort.Live;
                        break;
                    }
                }
            }

            if (data["wikimode"] != null)
            {
                var wikiMode = data["wikimode"].ValueOrDefault <string>();
                switch (wikiMode)
                {
                case "disabled":
                    WikiEditMode = WikiEditMode.None;
                    break;

                case "modonly":
                    WikiEditMode = WikiEditMode.Moderators;
                    break;

                case "anyone":
                    WikiEditMode = WikiEditMode.All;
                    break;
                }
            }

            if (data["subreddit_type"] != null)
            {
                var type = data["subreddit_type"].ValueOrDefault <string>();
                switch (type)
                {
                case "public":
                    SubredditType = SubredditType.Public;
                    break;

                case "private":
                    SubredditType = SubredditType.Private;
                    break;

                case "restricted":
                    SubredditType = SubredditType.Restricted;
                    break;
                }
            }

            ShowThumbnails = data["show_media"].ValueOrDefault <bool>();
            WikiEditAge    = data["wiki_edit_age"].ValueOrDefault <int>();

            if (data["content_options"] != null)
            {
                var contentOptions = data["content_options"].ValueOrDefault <string>();
                switch (contentOptions)
                {
                case "any":
                    ContentOptions = ContentOptions.All;
                    break;

                case "link":
                    ContentOptions = ContentOptions.LinkOnly;
                    break;

                case "self":
                    ContentOptions = ContentOptions.SelfOnly;
                    break;
                }
            }
        }