UNPKG

runnerty-notificator-twitter

Version:
29 lines (26 loc) 824 B
"use strict"; var Notification = global.NotificationClass; var T = require('twitter'); class twitterNotificator extends Notification { constructor(notification) { super(notification); } send(notification) { return new Promise((resolve, reject) => { var client = { consumer_key: notification.consumer_key, consumer_secret: notification.consumer_secret, access_token_key: notification.access_token_key, access_token_secret: notification.access_token_secret } var Twitter = new T(client); Twitter.post('statuses/update',{status:notification.tweet},function(error,tweet,response){ if (error) { reject("Tweet didn't send. Check your config."); } else resolve(); }); }); } } module.exports = twitterNotificator;