ai/src/index.ts
2018-08-13 17:54:56 +09:00

30 lines
918 B
TypeScript

import from './ai';
import config from './config';
import ReversiModule from './modules/reversi';
import ServerModule from './modules/server';
import PingModule from './modules/ping';
import EmojiModule from './modules/emoji';
import FortuneModule from './modules/fortune';
import GuessingGameModule from './modules/guessing-game';
import KeywordModule from './modules/keyword';
import * as request from 'request-promise-native';
const promiseRetry = require('promise-retry');
promiseRetry(retry => {
return request.post(`${config.apiUrl}/i`, {
json: {
i: config.i
}
}).catch(retry);
}).then(account => {
const ai = new (account);
ai.install(new PingModule());
ai.install(new EmojiModule());
ai.install(new FortuneModule());
ai.install(new GuessingGameModule());
ai.install(new ServerModule());
ai.install(new ReversiModule());
if (config.keywordEnabled) ai.install(new KeywordModule());
});