Skip to content
This repository has been archived by the owner on Feb 16, 2020. It is now read-only.

Commit

Permalink
Fixed Twitter Plugin (#2617)
Browse files Browse the repository at this point in the history
Updated setup function to correctly reference the Twitter API keys in the config file.
  • Loading branch information
crypto49er authored and askmike committed Nov 1, 2018
1 parent bf9ba55 commit 8634bc7
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions plugins/twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ var Twitter = function(done) {
this.price = 'N/A';
this.done = done;
this.setup();

};

Twitter.prototype.setup = function(done){
var setupTwitter = function (err, result) {
this.client = new TwitterApi({
consumer_key: config.consumer_key,
consumer_secret: config.consumer_secret,
access_token_key: config.access_token_key,
access_token_secret: config.access_token_secret
consumer_key: twitterConfig.consumer_key,
consumer_secret: twitterConfig.consumer_secret,
access_token_key: twitterConfig.access_token_key,
access_token_secret: twitterConfig.access_token_secret
});

if(twitterConfig.sendMessageOnStart){
Expand Down Expand Up @@ -52,7 +53,7 @@ Twitter.prototype.processCandle = function(candle, done) {
Twitter.prototype.processAdvice = function(advice) {
if (advice.recommendation == "soft" && twitterConfig.muteSoft) return;
var text = [
'New #ethereum trend. Attempting to ',
'New ', config.watch.asset, ' trend. Attempting to ',
advice.recommendation == "short" ? "sell" : "buy",
' @',
this.price,
Expand All @@ -65,9 +66,9 @@ Twitter.prototype.mail = function(content, done) {
log.info("trying to tweet");
this.client.post('statuses/update', {status: content}, function(error, tweet, response) {
if(error || !response) {
log.error('Pushbullet ERROR:', error)
log.error('Twitter ERROR:', error)
} else if(response && response.active){
log.info('Pushbullet Message Sent')
log.info('Twitter Message Sent')
}
});
};
Expand All @@ -79,4 +80,5 @@ Twitter.prototype.checkResults = function(err) {
log.info('Send advice via email.');
};


module.exports = Twitter;

0 comments on commit 8634bc7

Please sign in to comment.