From 340896c55354343c5119f82eb29f2b6038534bdd Mon Sep 17 00:00:00 2001 From: JandereDev Date: Sun, 1 May 2022 11:12:55 +0200 Subject: [PATCH] tmp commit --- bridge/package.json | 1 + bridge/src/discord/bridgeEmojis.ts | 12 ++++++++++++ bridge/src/types/DiscordBridgedEmoji.ts | 5 +++++ bridge/yarn.lock | 5 +++++ 4 files changed, 23 insertions(+) create mode 100644 bridge/src/discord/bridgeEmojis.ts create mode 100644 bridge/src/types/DiscordBridgedEmoji.ts diff --git a/bridge/package.json b/bridge/package.json index 99aa2a6..7984b5f 100644 --- a/bridge/package.json +++ b/bridge/package.json @@ -20,6 +20,7 @@ "discord.js": "^13.6.0", "dotenv": "^16.0.0", "form-data": "^4.0.0", + "json5": "^2.2.1", "log75": "^2.2.0", "monk": "^7.3.4", "prom-client": "^14.0.1", diff --git a/bridge/src/discord/bridgeEmojis.ts b/bridge/src/discord/bridgeEmojis.ts new file mode 100644 index 0000000..42d95ad --- /dev/null +++ b/bridge/src/discord/bridgeEmojis.ts @@ -0,0 +1,12 @@ +import axios from "axios"; +import JSON5 from 'json5'; + +const EMOJI_DICT_URL = 'https://raw.githubusercontent.com/revoltchat/revite/master/src/assets/emojis.ts'; + +async function fetchEmojiList(): Promise> { + const file: string = (await axios.get(EMOJI_DICT_URL)).data; + const start = file.indexOf('...{') + 3; + const end = file.indexOf('},') + 1; + + return JSON5.parse(file.substring(start, end).trim()); +} diff --git a/bridge/src/types/DiscordBridgedEmoji.ts b/bridge/src/types/DiscordBridgedEmoji.ts new file mode 100644 index 0000000..02aab63 --- /dev/null +++ b/bridge/src/types/DiscordBridgedEmoji.ts @@ -0,0 +1,5 @@ +export default class { + name: string; + emojiid: string; + animated: boolean; +} diff --git a/bridge/yarn.lock b/bridge/yarn.lock index 857076e..1bdefe2 100644 --- a/bridge/yarn.lock +++ b/bridge/yarn.lock @@ -315,6 +315,11 @@ js-yaml@^4.1.0: dependencies: argparse "^2.0.1" +json5@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" + integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== + lodash.defaultsdeep@^4.6.1: version "4.6.1" resolved "https://registry.yarnpkg.com/lodash.defaultsdeep/-/lodash.defaultsdeep-4.6.1.tgz#512e9bd721d272d94e3d3a63653fa17516741ca6"