Created
November 22, 2019 11:53
-
-
Save av/3dc8dd83f9023aa991c1969454762912 to your computer and use it in GitHub Desktop.
Now: twi-bot, twitter service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Twitter = require('twitter-lite'); | |
| const { | |
| CONSUMER_KEY, | |
| CONSUMER_SECRET, | |
| ACCESS_TOKEN_KEY, | |
| ACCESS_TOKEN_SECRET, | |
| } = process.env; | |
| const client = new Twitter({ | |
| subdomain: 'api', | |
| consumer_key: CONSUMER_KEY, | |
| consumer_secret: CONSUMER_SECRET, | |
| access_token_key: ACCESS_TOKEN_KEY, | |
| access_token_secret: ACCESS_TOKEN_SECRET | |
| }); | |
| module.exports = { | |
| tweet | |
| }; | |
| /** | |
| * Tweets given tween on behalf of user configured | |
| * by env variables | |
| * | |
| * @param {String} status | |
| * @returns {Promise} | |
| */ | |
| async function tweet(status) { | |
| return client.post('statuses/update', { status }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment