Skip to content

Commit

Permalink
Initialized snoowrap and can get Reddit posts from a username
Browse files Browse the repository at this point in the history
  • Loading branch information
dfireBird committed Dec 21, 2019
1 parent 5270453 commit e178aec
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"extends": "airbnb"
"extends": "airbnb",
"indent": ["error", "4"],
"new - cap": ["error", {
"newIsCap": false
}]
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,7 @@ dist

# Stores VSCode versions used for testing VSCode extensions
.vscode-test


#config
config.json
11 changes: 11 additions & 0 deletions Reddit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const Snoowrap = require('snoowrap');
const config = require('./config');

const Reddit = new Snoowrap({
userAgent: config.userAgent,
clientId: config.clientId,
clientSecret: config.clientSecret,
refreshToken: config.refreshToken,
});

module.exports = Reddit;
10 changes: 10 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const configJson = require('./config.json');

const config = {
userAgent: configJson.userAgent,
clientId: configJson.clientId,
clientSecret: configJson.clientSecret,
refreshToken: configJson.refreshToken,
};

module.exports = config;
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const Reddit = require('./Reddit');

Reddit.getHot().map(post => post.title).then(console.log)
6 changes: 6 additions & 0 deletions sample.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"userAgent": "/* Put user Agent here */",
"clientId": "/* Put your Client Id here */",
"clientSecret": "/* Put your Client Secret here */",
"refreshToken": "/* Put refreshToken here. For more information on getting credentials, see here: https://github.com/not-an-aardvark/reddit-oauth-helper */"
}

0 comments on commit e178aec

Please sign in to comment.