RedditSharp-DEPRECATED- icon indicating copy to clipboard operation
RedditSharp-DEPRECATED- copied to clipboard

Unable to get authornames of child comments replying to my comments, or authornames of the comments/posts I've replied to

Open steviecs opened this issue 4 years ago • 3 comments

The code I have attempted with isn't quite getting me there - just wanting to know if I'm making a mistake, or if this isn't currently supported. I also keep getting the following exception System.InvalidOperationException: Enumerator is in an invalid state;

        var myComments = reddit.User.GetComments(7).Where(i => i.More.Children.Any() || i.Parent != null);

        myComments.ForEach(comment =>
        {
            foreach (var property in comment.More.Children)
            {
                Console.WriteLine(property);
            }
        });


        myComments.ForEach(comments =>
        {
            foreach (var comment in comments.Comments)
            {
                Console.WriteLine(comment.AuthorName);
            }
        });

I can't grab any properties relating to children author names off of property or comment. I've tried a couple different ways, but I was able to do this with people who replied to my posts - just not those who have replied to my comments.

Any insight is welcome, thanks!

steviecs avatar Mar 09 '20 21:03 steviecs

What version are you using? And what exactly is throwing that exception. Nothing's catching my eye that's wrong.

CrustyJew avatar Mar 11 '20 02:03 CrustyJew

What version are you using? And what exactly is throwing that exception. Nothing's catching my eye that's wrong.

The line throwing that exception is: var myComments = reddit.User.GetComments(7).Where(i => i.More.Children.Any() || i.Parent != null);

I just now determined that the version I've been using was 1.0.0, which seems suspect given that you asked which version.

I also see 1.0.4 available, which I just installed - as well as a 2.0.0 from which I think is not your library:

image

I'm using Rider, but I can't imagine that matters at all.

steviecs avatar Mar 11 '20 02:03 steviecs

That 2.0 version looks correct, I haven't done nuget in VSCode (at least that what your IDE looks like). Try using that instead first. I need to just push it to a non pre-release state and get over it >.<

CrustyJew avatar Mar 18 '20 16:03 CrustyJew