diff options
author | RaindropsSys <raindrops@equestria.dev> | 2023-11-17 23:25:29 +0100 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2023-11-17 23:25:29 +0100 |
commit | 953ddd82e48dd206cef5ac94456549aed13b3ad5 (patch) | |
tree | 8f003106ee2e7f422e5a22d2ee04d0db302e66c0 /includes/external/addressbook/twitter.js | |
parent | 62a9199846b0c07c03218703b33e8385764f42d9 (diff) | |
download | pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.gz pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.bz2 pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.zip |
Updated 30 files and deleted 2976 files (automated)
Diffstat (limited to 'includes/external/addressbook/twitter.js')
-rw-r--r-- | includes/external/addressbook/twitter.js | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/includes/external/addressbook/twitter.js b/includes/external/addressbook/twitter.js deleted file mode 100644 index d8834ca..0000000 --- a/includes/external/addressbook/twitter.js +++ /dev/null @@ -1,64 +0,0 @@ -const axios = require('axios'); -const apiVersion = "2"; -const app = require('../../app.json'); - -function sleep(ms) { - return new Promise((res) => { - setTimeout(res, ms); - }); -} - -(async () => { - let user = process.argv[2]; - - try { - let data = (await axios.get(`https://api.twitter.com/${apiVersion}/users/${user}?user.fields=id,description,profile_image_url`, { - headers: { - Authorization: `Bearer ${app.twitter.bearer}` - } - })).data.data; - - let obj = { - error: null, - avatar: "https://img.icons8.com/fluency-systems-regular/64/ffffff/twitter.png", - name: data['name'], - description: `@${data['username']}`, - link: `https://twitter.com/${data['username']}`, - copy: [ - { - title: "Copy link to profile", - text: `https://twitter.com/${data['username']}` - }, - { - title: "Copy username", - text: `@${data['username']}` - }, - { - title: "Copy ID", - text: `${data['id']}` - }, - data['profile_image_url'] ? { - title: "Copy avatar URL", - text: data['profile_image_url'] - } : null - ] - } - - if (data['profile_image_url']) { - obj.avatar = data['profile_image_url']; - } - - console.log(JSON.stringify(obj, null, 2)); - } catch (e) { - console.log(JSON.stringify({ - error: e, - avatar: "https://img.icons8.com/fluency-systems-regular/64/ffffff/twitter.png", - name: user, - description: "Twitter", - link: null, - copy: [] - }, null, 2)); - } - - -})();
\ No newline at end of file |