Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@orbit-love/reddit

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@orbit-love/reddit - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

docs/activity-comment.png

2

package.json
{
"name": "@orbit-love/reddit",
"version": "0.2.0",
"version": "0.3.0",
"description": "Integrate Reddit interactions into Orbit workspaces",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -9,2 +9,5 @@ # Reddit to Orbit Workspace

![](docs/activity-post.png)
![](docs/activity-comment.png)
|<p align="left">:sparkles:</p> This is a *community project*. The Orbit team does its best to maintain it and keep it up to date with any recent API changes.<br/><br/>We welcome community contributions to make sure that it stays current. <p align="right">:sparkles:</p>|

@@ -96,2 +99,4 @@ |-----------------------------------------|

### Timeframe
By default this will get the last 24 hours worth of activity, but this can be explicitly overridden:

@@ -103,2 +108,9 @@

### Filtering
You can pass in a `--filter=term` flag to filter the results by a single term.
* For posts this will match if the post title, url or body text contain the term.
* For comments this will match if it was left on a post with a title containing the term, or the comment itself contains the term.
## GitHub Actions Automation Setup

@@ -105,0 +117,0 @@

@@ -26,3 +26,9 @@ #!/usr/bin/env node

if(args.posts) {
const posts = await orbitReddit.getPosts({ subreddit: args.subreddit, hours })
let posts = await orbitReddit.getPosts({ subreddit: args.subreddit, hours })
if(args.filter) posts = posts.filter(p => {
const inTitle = p.title.toLowerCase().includes(args.filter.toLowerCase())
const inBody = p.selftext.toLowerCase().includes(args.filter.toLowerCase())
const inUrl = p.url.toLowerCase().includes(args.filter.toLowerCase())
return inTitle || inBody || inUrl
})
console.log(`Fetched ${posts.length} posts from the provided timeframe`)

@@ -36,3 +42,10 @@ const prepared = await orbitReddit.preparePosts(posts)

if(args.comments) {
const comments = await orbitReddit.getComments({ subreddit: args.subreddit, hours })
let comments = await orbitReddit.getComments({ subreddit: args.subreddit, hours })
if(args.filter) {
comments = comments.filter(c => {
const inTitle = c.link_title.toLowerCase().includes(args.filter.toLowerCase())
const inBody = c.body.toLowerCase().includes(args.filter.toLowerCase())
return inTitle || inBody
})
}
console.log(`Fetched ${comments.length} comments from the provided timeframe`)

@@ -39,0 +52,0 @@ const prepared = await orbitReddit.prepareComments(comments)

@@ -81,6 +81,7 @@ const moment = require('moment')

activity: {
description: item.body,
description: `Post: ${item.link_title}\n\n${item.body}`,
link: `https://reddit.com${item.permalink}`,
link_text: `View post on ${item.subreddit_name_prefixed}`,
title: `Comment on ${item.link_title} in ${item.subreddit_name_prefixed}`,
title: `Comment in ${item.subreddit_name_prefixed}`,
tags: ['channel:reddit'],
activity_type: 'reddit:comment',

@@ -95,3 +96,2 @@ key: `reddit-comment-${item.author.name}-${item.created_utc}`,

url: `https://reddit.com/u/${item.author.name}`,
uid: item.author_fullname
}

@@ -98,0 +98,0 @@ }

@@ -69,3 +69,3 @@ const pkg = require('../package.json')

} else {
throw new Error(result.reason.errors)
throw new Error(JSON.stringify(result.reason))
}

@@ -72,0 +72,0 @@ } else {

@@ -81,6 +81,7 @@ const moment = require('moment')

activity: {
description: `Title: ${item.title}`,
description: item.title,
link: `https://reddit.com${item.permalink}`,
link_text: `View post on ${item.subreddit_name_prefixed}`,
title: `Posted to ${item.subreddit_name_prefixed}`,
tags: ['channel:reddit'],
activity_type: 'reddit:post',

@@ -87,0 +88,0 @@ key: `reddit-post-${item.author.name}-${item.created_utc}`,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc