-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
39 lines (31 loc) · 1.22 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const axios = require("axios");
const dotenv = require("dotenv");
const { TwitterApi } = require("twitter-api-v2");
dotenv.config();
const twitterClient = new TwitterApi({
appKey: process.env.API_KEY,
appSecret: process.env.API_SECRET,
accessToken: process.env.ACCESS_TOKEN,
accessSecret: process.env.ACCESS_TOKEN_SECRET,
});
async function tweetScore() {
axios
.get(`https://api.jumpmaster.xyz/misc/predThreshold`)
.then(async function (response) {
const data = response.data;
const tweetText = `-RP Threshold for Apex Predator-\n\nPC: ${data.PC.value.toLocaleString()} RP [${data.PC.count.toLocaleString()} Players]\nPlayStation: ${data.Playstation.value.toLocaleString()} RP [${data.Playstation.count.toLocaleString()} Players]\nXbox: ${data.Xbox.value.toLocaleString()} RP [${data.Xbox.count.toLocaleString()} Players]\nSwitch: ${data.Switch.value.toLocaleString()} RP [${data.Switch.count.toLocaleString()} Players]\n\n#ApexLegends #ApexLegendsRanked\n(${
data.timestamp
})`;
try {
await twitterClient.v2.tweet(tweetText);
} catch (e) {
console.log(e);
}
console.log(tweetText);
// console.log("Posted tweet.");
})
.catch(function (error) {
console.log(error);
});
}
tweetScore();