function isAlreadyTweeted(url) {
    // The Twitter Search API is a mess, can't handle the @ character
    const urlAllowedParts = url.split('@');
    return new Promise(resolve => {
        const query = { q: 'url:' + urlAllowedParts[urlAllowedParts.length - 1], count: 100, result_type: 'recent' };
        twitter.get('search/tweets', query, (err, data, response) => {
            if(err) reject(err);
            else resolve(data.statuses.some(tweet => tweet.user.screen_name === twitter_handle));
        });
    });
}
// This function is still a prototype and may resolve to false with some already tweeted links
This function is still a prototype and may resolve to false with some already tweeted links
This function is still a prototype and may resolve to false with some already tweeted links
function isAlreadyTweeted(url) {
    const urlAllowedParts = url.split('@');
    return new Promise(resolve => {
        const query = { q: 'url:' + urlAllowedParts[urlAllowedParts.length - 1], count: 100, result_type: 'recent' };
        twitter.get('search/tweets', query, (err, data, response) => {
            if(err) reject(err);
            else resolve(data.statuses.some(tweet => tweet.user.screen_name === twitter_handle));
        });
    });
}
function isAlreadyTweeted ( url ) { const urlAllowedParts = url . split ( '@' ) ; return new Promise ( resolve => { const query = { q : 'url:' + urlAllowedParts [ urlAllowedParts . length - 1 ] , count : 100 , result_type : 'recent' } ; twitter . get ( 'search/tweets' , query , ( err , data , response ) => { if ( err ) reject ( err ) ; else resolve ( data . statuses . some ( tweet => tweet . user . screen_name === twitter_handle ) ) ; } ) ; } ) ; }
This function is still a prototype and may resolve to false with some already tweeted links
This function is still a prototype and may resolve to false with some already tweeted links
// The Twitter Search API is a mess, can't handle the @ character