mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-25 23:36:44 -06:00
31 lines
586 B
TypeScript
31 lines
586 B
TypeScript
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);
|
|
});
|