From a468e667ba5363dcecf3062f7a1bc5cadbd14ae4 Mon Sep 17 00:00:00 2001 From: sdfnz <30536578+sdfnz@users.noreply.github.com> Date: Sat, 13 Oct 2018 19:14:50 -0500 Subject: [PATCH] Added functionality to tweet from the command line with custom messages --- README.md | 9 ++++++++- bot.js | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 34d5d9c..c1b0cb5 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,9 @@ # TwitterBot -A sample Twitter Bot that automatically tweets. +A sample Twitter Bot that will tweet whatever you type to the command line. + +## How to use +Call bot.js through Node and type the message you want to tweet to the command line. +Make sure to put your message in quotes if it's more than one word. + +Example: `node bot.js "I'm tweeting from the command line!"` + diff --git a/bot.js b/bot.js index 9ad6917..969fd0f 100644 --- a/bot.js +++ b/bot.js @@ -6,9 +6,12 @@ var Twit = require('twit'); var config = require('./config'); var T = new Twit(config); +// grab the tweet message from the command line arguments +var msg = process.argv[2]; + //the message we want to post var tweet_message = { - status: 'My First Tweet using #TwitterAPI and #NodeJS' + status: msg } //This posts our tweet