aboutsummaryrefslogtreecommitdiffstats
path: root/generate_weemoji.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2020-02-01 15:19:29 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2020-02-01 15:30:32 +0100
commitf3f416edc18c38b39257bf1f87848df1294f4b3f (patch)
tree48676e1e3653dd8a094fa32812f2c1a4ee33b996 /generate_weemoji.py
parent4f9863d992e549ceff38c26d08e435f14bbfc597 (diff)
downloadwee-slack-f3f416edc18c38b39257bf1f87848df1294f4b3f.tar.gz
Render emojis as emoji characters
Fixes #465
Diffstat (limited to 'generate_weemoji.py')
-rwxr-xr-xgenerate_weemoji.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/generate_weemoji.py b/generate_weemoji.py
new file mode 100755
index 0000000..022cd4b
--- /dev/null
+++ b/generate_weemoji.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+
+import json
+import sys
+
+all_emojis = json.loads(sys.stdin.read())
+
+def convert_unicode_string(emoji_dict):
+ for k, v in emoji_dict.items():
+ if k == 'unicode':
+ emoji_dict[k] = ''.join([chr(int(x, 16)) for x in v.split('-')])
+ if type(v) == dict:
+ convert_unicode_string(v)
+
+convert_unicode_string(all_emojis)
+
+with open('weemoji.json', 'w') as weemoji:
+ json.dump(all_emojis, weemoji, indent=2, sort_keys=True)
+ weemoji.write('\n')