Skip to content

Comments from multiple subreddits #211

Closed
@jonerer

Description

@jonerer

Hello!

I'm using jraw version 1.0.0

I'm trying to get comments from multiple subreddits. When getting comments for one, I do this:

    var r = reddit.subreddit("first").comments().build();

But when trying to do the same thing for multiple subscriptions I face this:

    var r = reddit.subreddits("first", "second").comments().build(); // <--- unresolved reference "comments"

I found the reason in the source code in RedditClient.kt on line 301:

    fun subreddits(first: String, second: String, vararg others: String) =
        SubredditReference(this, arrayOf(first, second, *others).joinToString("+")).posts()

The fact that subreddit returns a SubredditReference but subreddits returns a posts iterator seems confusing. Is there a way for me to get comments for multiple subreddits?

As a temporary solution I borrowed the code from RedditClient, and did this: reddit.subreddit(arrayOf("btc", "bitcoin").joinToString("+")).comments().build(); which works fine, but seems like I'm working against the library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions