From 80b5fda292efd70cc749910e3672d50c9a70a72e Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Fri, 2 Nov 2018 08:59:40 +0900 Subject: Remote custom emojis (#3074) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remote custom emojis * んほおおおおお --- src/tools/add-emoji.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/tools/add-emoji.ts (limited to 'src/tools') 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 { + 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); +}); -- cgit v1.2.3-freya