parent
c48cbd95f6
commit
80b5fda292
18 changed files with 193 additions and 24 deletions
31
src/tools/add-emoji.ts
Normal file
31
src/tools/add-emoji.ts
Normal file
|
@ -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);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue