public SelfPromotionCombustor( SelfPromotionCombustorSettings settings, RedditSharp.Reddit client ) : this() { RedditClient = client; Settings = settings; PercentageThreshold = settings.PercentageThreshold; IncludePostInPercentage = settings.IncludePostInPercentage; RemovalFlair = settings.RemovalFlair; GracePeriod = settings.GracePeriod; }
static IEnumerable<RedditSharp.ModeratorUser> GetModerators( string subName, RedditSharp.IWebAgent agent, RedditSharp.Reddit reddit ) { var request = agent.CreateGet( string.Format( ModeratorsUrl, subName ) ); var response = request.GetResponse(); var responseString = agent.GetResponseString( response.GetResponseStream() ); var json = JObject.Parse( responseString ); var type = json["kind"].ToString(); if ( type != "UserList" ) throw new FormatException( "Reddit responded with an object that is not a user listing." ); var data = json["data"]; var mods = data["children"].ToArray(); var result = new RedditSharp.ModeratorUser[mods.Length]; for ( var i = 0; i < mods.Length; i++ ) { var mod = new RedditSharp.ModeratorUser( reddit, mods[i] ); result[i] = mod; } return result; }
static void RecursivelyInspectComments(Func<Subs.Post, RedditSharp.Things.Comment, Subs.Comment, Subs.Comment> commentFunc, Subs.Post post, RedditSharp.Things.Comment redditComment, Subs.Comment parentComment = null) { if (redditComment.Kind == "more") { return; } if (redditComment.Kind != "t1") { return; } var comment = commentFunc(post, redditComment, parentComment); if (comment == null) return; foreach (var childRedditComment in redditComment.Comments) { RecursivelyInspectComments(commentFunc, post, childRedditComment, comment); } }
public AutoModWrangler( RedditSharp.Things.Subreddit subreddit ) { Subreddit = subreddit; }
public HighTechBanHammer( HighTechBanHammerSettings sets, RedditSharp.Things.Subreddit subreddit ) : this() { Settings = sets; Subreddit = subreddit; }