summaryrefslogtreecommitdiff
path: root/includes/external/addressbook/reddit.js
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2023-11-17 23:25:29 +0100
committerRaindropsSys <raindrops@equestria.dev>2023-11-17 23:25:29 +0100
commit953ddd82e48dd206cef5ac94456549aed13b3ad5 (patch)
tree8f003106ee2e7f422e5a22d2ee04d0db302e66c0 /includes/external/addressbook/reddit.js
parent62a9199846b0c07c03218703b33e8385764f42d9 (diff)
downloadpluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.gz
pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.bz2
pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.zip
Updated 30 files and deleted 2976 files (automated)
Diffstat (limited to 'includes/external/addressbook/reddit.js')
-rw-r--r--includes/external/addressbook/reddit.js63
1 files changed, 0 insertions, 63 deletions
diff --git a/includes/external/addressbook/reddit.js b/includes/external/addressbook/reddit.js
deleted file mode 100644
index 3e5dd15..0000000
--- a/includes/external/addressbook/reddit.js
+++ /dev/null
@@ -1,63 +0,0 @@
-const axios = require('axios');
-
-function sleep(ms) {
- return new Promise((res) => {
- setTimeout(res, ms);
- });
-}
-
-(async () => {
- let user = process.argv[2];
-
- if (user.startsWith("u/")) user = user.substring(2);
- if (user.startsWith("user/")) user = user.substring(5);
-
- try {
- let data = (await axios.get(`https://www.reddit.com/user/${user}/about.json`)).data.data;
-
- if (data['icon_img']) data['icon_img'] = data['icon_img'].replaceAll("&amp;", "&");
-
- let obj = {
- error: null,
- avatar: "https://img.icons8.com/fluency-systems-regular/64/ffffff/reddit.png",
- name: data['subreddit']['title'] ?? data['name'],
- description: data['subreddit']['display_name_prefixed'],
- link: `https://www.reddit.com${data['subreddit']['url']}`,
- copy: [
- {
- title: "Copy link to profile",
- text: `https://www.reddit.com${data['subreddit']['url']}`
- },
- {
- title: "Copy username",
- text: data['username']
- },
- {
- title: "Copy ID",
- text: data['id']
- },
- data['icon_img'] ? {
- title: "Copy avatar URL",
- text: data['icon_img']
- } : null
- ]
- }
-
- if (data['icon_img']) {
- obj.avatar = data['icon_img'];
- }
-
- 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/reddit.png",
- name: user,
- description: "Reddit",
- link: null,
- copy: []
- }, null, 2));
- }
-
-
-})(); \ No newline at end of file