Repository navigation
RFC: Ability to add resources from the Subreddit #62
Description
Activity
- changed the title
[-]RFC: Ability to add watch and add resources from the Subreddit[/-][+]RFC: Ability to add resources from the Subreddit[/+]on Feb 15, 2024 I think that adding this to the wiki on the sub Reddit and defining a proper format would be much more feasible.
We can have a mega thread and a Reddit bot, so if we see any link shared around, we can call the bot to check if the link is already added into resource list. The links that do pass this check will get added to the resource mega thread, from where we can add them into the repo.
(Alternatively, we can keep a list of links that were added through Reddit in the repo in JSON format, that would avoid duplicate links from getting into the repo and also will serve as a record library).
Also, we can call the bot automatically under every comment or post that shares a link and remind them of the format.
We can create a script in https://github.com/developersIndia/deviras for that.
Yep, the closest I can see is the community thread script, that grabs posts from community thread, we can create a similar one that can collect links from posts and comments from Subreddit when it's called.
I will start working on it, just give me some time to go through the code base.
we can make it auto-call it itself from resource flaired posts or we can just add a
!resourcecommands for mods to run.for comment in subreddit.stream.comments(): if COMMAND in comment.body and comment.author in subreddit.moderator(): # insert logic here comment.reply(RESOURCE) print("Resource shared successfully.")should be easy with praw
Looks good, but that's assuming that people would actually properly flair their posts.
There could be a lot of posts that can have discussion flair but still a lot of links, we definitely need the
!resourcecommand for that so mods themselves can perform the action.How about something like this:
sub = "developersIndia" subreddit = reddit.subreddit(sub) resourceLinks = set() # set to avoid duplicate links # Loop through submissions with the flair 'resources' for submission in subreddit.search("flair:resources"): # Fetch comments for the submission submission.comments.replace_more(limit=None) for comment in submission.comments.list(): # Extract resource links from comment body resource_links = re.findall(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', comment.body) # Add unique links to the set resourceLinks.update(resource_links)But we do need a set rule, like asking users to post resources like
[JavaScript] (<resource>), that would help out in filtering the already existing list of resources and avoid duplicate addition.
Feature details?
The flow:
Resourcesflair on Reddit.Code of Conduct