Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
twitter.start = function (client, config){
if (!config.auth.bitly.key) {
console.log("warn: bitly API credentials not detected. Shortlinks to tweets will not be added.".magenta);
}
else {
twitter.bitly = new Bitly(config.auth.bitly.user, config.auth.bitly.key);
}
if ((!config.auth.twitter.access_token_key)&&(!config.auth.twitter.consumer_key)) {
console.log("warn: twitter credentials not detected, disabling Twitter functionality".magenta);
}
else {
twit = new twitobj(config.auth.twitter);
twit.verifyCredentials(function (data) {
if (data.statusCode != 200) {
console.log("err: twitter credentials have been rejected by the Twitter API.".red);
console.log("Error Status Code".red, data.statusCode);
}
else if ((!config.plugins.twitter.userid)||(data.id != config.plugins.twitter.userid)) {
console.log('info: Twitter has verified new user ID: '.cyan, data.id_str);
config.plugins.twitter.userid = data.id;
}
});