-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (29 loc) · 969 Bytes
/
index.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
require("dotenv").config();
const Twitter = require("twitter");
const client = new Twitter({
consumer_key: process.env.TWITTER_CONSUMER_KEY,
consumer_secret: process.env.TWITTER_CONSUMER_SECRET,
access_token_key: process.env.TWITTER_ACCESS_KEY,
access_token_secret: process.env.TWITTER_ACCESS_SECRET,
});
const detoxDate = new Date("04/12/2022");
const dayDiff = Math.ceil(
(Date.now() - detoxDate.getTime()) / (1000 * 60 * 60 * 24)
);
const bio = `⚠️ i'm on twitter detox until 31/04 ⚠️
I am detoxing for ${dayDiff} days. (bot updates)
Public speaker, cloud champion, backend engineer, community organizer`;
(async () => {
try {
const response = await client.post("account/update_profile", {
description: bio,
});
if(!response.id){
throw new Error("No response id")
}
console.log(`Successfully updated bio to ${dayDiff}`);
} catch (error) {
console.error(error);
process.exit(1);
}
})();