From a51065db6fce853a55008d5c3ddd08ec4a7b9df5 Mon Sep 17 00:00:00 2001 From: chris062689 Date: Wed, 28 Feb 2018 23:18:19 -0500 Subject: [PATCH] Added a default limit for how many tweets are returned in a timeline. --- twitter/app.js | 2 +- twitter/env.json | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/twitter/app.js b/twitter/app.js index 83ee4c0..79b3300 100644 --- a/twitter/app.js +++ b/twitter/app.js @@ -15,7 +15,7 @@ const client = new Twitter({ }); client.get('statuses/user_timeline', {screen_name: process.env.TWITTER_SCREEN_NAME}).then(tweets => { - return tweets.map((x, index) => { + return tweets.slice(0, process.env.TWITTER_TIMELINE_COUNT + 1 || 5 + 1).map((x, index) => { return { id: x.id_str, order: index, diff --git a/twitter/env.json b/twitter/env.json index 551368f..6b02a70 100644 --- a/twitter/env.json +++ b/twitter/env.json @@ -3,5 +3,7 @@ "TWITTER_CONSUMER_SECRET": true, "TWITTER_ACCESS_TOKEN_KEY": true, "TWITTER_ACCESS_TOKEN_SECRET": true, - "TWITTER_SCREEN_NAME": true -} \ No newline at end of file + "TWITTER_SCREEN_NAME": true, + "TWITTER_TIMELINE_COUNT": false +} +