Skip to content

Commit

Permalink
Implement tweet random number method
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetcandiroglu committed Aug 26, 2017
1 parent d9dc536 commit d66f52f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ node_modules/
.idea/

src/config.js
media/
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
worker : node bot.js
worker: node bot.js
20 changes: 19 additions & 1 deletion bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ const tweet = require('./src/tweet');
const T = new Twit(twit_config);

let user_stream = T.stream('user');
console.log("User stream has started..");
console.log("User stream has started\n----------------------");

user_stream.on('follow', followed);


function followed(event) {
const screen_name = event.source.screen_name;

Expand Down Expand Up @@ -39,3 +40,20 @@ function followed(event) {
});

}

function tweet_random_number(){

let number = Math.floor( Math.random() * 100 );

const tweet_params = {
status: number + " #bottweetsgifs"
};

tweet.post_status(T, tweet_params)
.then(data => {
console.log('Tweet has been posted..');
})
.catch(err => {
console.log('Tweet could not posted!', err);
});
}
Empty file added media/thanks.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d66f52f

Please sign in to comment.