function tweet(message, url) {
    // Checking if the link has already been included in a tweet from this account
    isAlreadyTweeted(url)
        .then(alreadyTweeted => {
            if(!alreadyTweeted) {
                twitter.post('statuses/update', { status: message }, (err, data, response) => {
                    if(err) {
                        // The tweet already exists
                        if(err.code === 187) console.error('Error: The tweet \'' + message + '\' already exists');
                        // Retry if it's another error
                        else {
                            console.error('Unknown error:', err.message);
                            console.log('Please notify @ragepeanut of the encountered error so it doesn\'t happen to other users')
                            console.log('Retrying...');
                            setTimeout(tweet, tweet_retry_timeout, message);
                        }
                    } else console.log('Successfully tweeted', message);
                });
            } else console.log('A tweet with the same link has already been sent.');
        })
        .catch(err => {
            console.err('Twitter Search API Error:', err.message);
            console.log('Retrying...');
            setTimeout(tweet, tweet_retry_timeout, message, url);
        });
}
// Tweets the content of the message
Tweets the content of the message
Tweets the content of the message
function tweet(message, url) {
    isAlreadyTweeted(url)
        .then(alreadyTweeted => {
            if(!alreadyTweeted) {
                twitter.post('statuses/update', { status: message }, (err, data, response) => {
                    if(err) {
                        if(err.code === 187) console.error('Error: The tweet \'' + message + '\' already exists');
                        else {
                            console.error('Unknown error:', err.message);
                            console.log('Please notify @ragepeanut of the encountered error so it doesn\'t happen to other users')
                            console.log('Retrying...');
                            setTimeout(tweet, tweet_retry_timeout, message);
                        }
                    } else console.log('Successfully tweeted', message);
                });
            } else console.log('A tweet with the same link has already been sent.');
        })
        .catch(err => {
            console.err('Twitter Search API Error:', err.message);
            console.log('Retrying...');
            setTimeout(tweet, tweet_retry_timeout, message, url);
        });
}
function tweet ( message , url ) { isAlreadyTweeted ( url ) . then ( alreadyTweeted => { if ( ! alreadyTweeted ) { twitter . post ( 'statuses/update' , { status : message } , ( err , data , response ) => { if ( err ) { if ( err . code === 187 ) console . error ( 'Error: The tweet \'' + message + '\' already exists' ) ; else { console . error ( 'Unknown error:' , err . message ) ; console . log ( 'Please notify @ragepeanut of the encountered error so it doesn\'t happen to other users' ) console . log ( 'Retrying...' ) ; setTimeout ( tweet , tweet_retry_timeout , message ) ; } } else console . log ( 'Successfully tweeted' , message ) ; } ) ; } else console . log ( 'A tweet with the same link has already been sent.' ) ; } ) . catch ( err => { console . err ( 'Twitter Search API Error:' , err . message ) ; console . log ( 'Retrying...' ) ; setTimeout ( tweet , tweet_retry_timeout , message , url ) ; } ) ; }
Tweets the content of the message
Tweets the content of the message
// Checking if the link has already been included in a tweet from this account // The tweet already exists // Retry if it's another error