Skip to content

Commit e659024

Browse files
Merge pull request #93 from NazimFilzer/email
2 parents f7cc961 + 19ead4f commit e659024

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed

NodeJS/14-TwitterBot/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const rwClient=require("./twitterClient");
2+
3+
const tweet=async()=>{
4+
try {
5+
await rwClient.v2.tweet("Testing Twitter Bot") // Tweeting
6+
} catch (error) {
7+
console.log(error);
8+
}
9+
}
10+
11+
tweet()

NodeJS/14-TwitterBot/package-lock.json

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

NodeJS/14-TwitterBot/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "twitterbot",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"dependencies": {
13+
"twitter-api-v2": "^1.12.5"
14+
}
15+
}

NodeJS/14-TwitterBot/twitterClient.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const { TwitterApi } = require("twitter-api-v2");
2+
3+
// All the Credentilas Will be Available in The Twitter Developer Website
4+
5+
const client = new TwitterApi({
6+
appKey: "Enter API key",
7+
appSecret: "Enter Secret Key",
8+
accessToken: "Enter Access Token",
9+
accessSecret: "Enter Access Secret"
10+
})
11+
12+
const rwClient = client.readWrite
13+
ss
14+
15+
module.exports = rwClient;

0 commit comments

Comments
 (0)