예제 #1
0
 public SelfPromotionCombustor( SelfPromotionCombustorSettings settings, RedditSharp.Reddit client ) : this() {
     RedditClient = client;
     Settings = settings;
     PercentageThreshold = settings.PercentageThreshold;
     IncludePostInPercentage = settings.IncludePostInPercentage;
     RemovalFlair = settings.RemovalFlair;
     GracePeriod = settings.GracePeriod;
 }
예제 #2
0
 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;
 }
예제 #3
0
        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);
            }
        }
예제 #4
0
 public AutoModWrangler( RedditSharp.Things.Subreddit subreddit ) {
     Subreddit = subreddit;
 }
예제 #5
0
 public HighTechBanHammer( HighTechBanHammerSettings sets, RedditSharp.Things.Subreddit subreddit ) : this() {
     Settings = sets;
     Subreddit = subreddit;
 }