summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorMeiMei <30769358+mei23@users.noreply.github.com>2018-11-02 08:59:40 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2018-11-02 08:59:40 +0900
commit80b5fda292efd70cc749910e3672d50c9a70a72e (patch)
treea8f287c9c60a532112801d084fcb7d5b8c4e3650 /src/tools
parentFix bug (diff)
downloadsharkey-80b5fda292efd70cc749910e3672d50c9a70a72e.tar.gz
sharkey-80b5fda292efd70cc749910e3672d50c9a70a72e.tar.bz2
sharkey-80b5fda292efd70cc749910e3672d50c9a70a72e.zip
Remote custom emojis (#3074)
* Remote custom emojis * んほおおおおお
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/add-emoji.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/tools/add-emoji.ts b/src/tools/add-emoji.ts
new file mode 100644
index 0000000000..875af55c14
--- /dev/null
+++ b/src/tools/add-emoji.ts
@@ -0,0 +1,31 @@
+import * as debug from 'debug';
+import Emoji from "../models/emoji";
+
+debug.enable('*');
+
+async function main(name: string, url: string, alias?: string): Promise<any> {
+ const aliases = alias != null ? [ alias ] : [];
+
+ await Emoji.insert({
+ host: null,
+ name,
+ url,
+ aliases,
+ updatedAt: new Date()
+ });
+}
+
+const args = process.argv.slice(2);
+const name = args[0];
+const url = args[1];
+
+if (!name) throw 'require name';
+if (!url) throw 'require url';
+
+main(name, url).then(() => {
+ console.log('success');
+ process.exit(0);
+}).catch(e => {
+ console.warn(e);
+ process.exit(1);
+});