2018-08-11 06:26:25 +00:00
|
|
|
import 藍 from './ai';
|
2018-08-11 01:42:06 +00:00
|
|
|
import config from './config';
|
2018-08-23 08:27:39 +00:00
|
|
|
|
2018-08-26 21:59:18 +00:00
|
|
|
import CoreModule from './modules/core';
|
2018-08-11 01:42:06 +00:00
|
|
|
import ReversiModule from './modules/reversi';
|
2018-08-11 06:26:25 +00:00
|
|
|
import PingModule from './modules/ping';
|
2018-08-11 06:53:49 +00:00
|
|
|
import EmojiModule from './modules/emoji';
|
2018-08-11 09:43:50 +00:00
|
|
|
import FortuneModule from './modules/fortune';
|
2018-08-12 14:03:00 +00:00
|
|
|
import GuessingGameModule from './modules/guessing-game';
|
2018-08-13 08:54:56 +00:00
|
|
|
import KeywordModule from './modules/keyword';
|
2018-08-13 21:14:47 +00:00
|
|
|
import WelcomeModule from './modules/welcome';
|
2018-08-23 08:27:39 +00:00
|
|
|
import TimerModule from './modules/timer';
|
2018-09-03 14:42:28 +00:00
|
|
|
import DiceModule from './modules/dice';
|
2018-09-03 02:56:58 +00:00
|
|
|
import ServerModule from './modules/server';
|
2018-12-03 08:12:47 +00:00
|
|
|
import FollowModule from './modules/follow';
|
2019-01-12 04:14:16 +00:00
|
|
|
import ValentineModule from './modules/valentine';
|
2018-08-23 08:27:39 +00:00
|
|
|
|
2018-08-11 06:26:25 +00:00
|
|
|
import * as request from 'request-promise-native';
|
2018-08-28 07:02:20 +00:00
|
|
|
import IModule from './module';
|
2018-08-11 06:26:25 +00:00
|
|
|
const promiseRetry = require('promise-retry');
|
2018-08-11 03:34:24 +00:00
|
|
|
|
2018-08-26 21:59:18 +00:00
|
|
|
console.log('--- starting ai... ---');
|
2018-08-23 08:27:39 +00:00
|
|
|
|
2018-08-11 06:26:25 +00:00
|
|
|
promiseRetry(retry => {
|
|
|
|
return request.post(`${config.apiUrl}/i`, {
|
|
|
|
json: {
|
|
|
|
i: config.i
|
2018-08-10 17:28:31 +00:00
|
|
|
}
|
2018-08-11 06:26:25 +00:00
|
|
|
}).catch(retry);
|
|
|
|
}).then(account => {
|
2018-08-27 08:36:51 +00:00
|
|
|
console.log(`account fetched: @${account.username}`);
|
2018-08-23 08:27:39 +00:00
|
|
|
|
2018-08-28 07:02:20 +00:00
|
|
|
const modules: IModule[] = [
|
|
|
|
new EmojiModule(),
|
|
|
|
new FortuneModule(),
|
|
|
|
new GuessingGameModule(),
|
|
|
|
new ReversiModule(),
|
2018-09-03 02:56:58 +00:00
|
|
|
new TimerModule(),
|
2018-09-03 14:42:28 +00:00
|
|
|
new DiceModule(),
|
2018-10-09 15:07:40 +00:00
|
|
|
new CoreModule(),
|
|
|
|
new PingModule(),
|
|
|
|
new WelcomeModule(),
|
2018-12-03 07:48:00 +00:00
|
|
|
new ServerModule(),
|
|
|
|
new FollowModule(),
|
2019-01-12 04:14:16 +00:00
|
|
|
new ValentineModule(),
|
2018-08-28 07:02:20 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
if (config.keywordEnabled) modules.push(new KeywordModule());
|
|
|
|
|
|
|
|
new 藍(account, modules);
|
2018-08-23 08:27:39 +00:00
|
|
|
|
2018-08-26 21:59:18 +00:00
|
|
|
console.log('--- ai started! ---');
|
2018-10-11 06:38:17 +00:00
|
|
|
}).catch(e => {
|
|
|
|
console.error('failed to fetch account', e);
|
2018-08-11 06:26:25 +00:00
|
|
|
});
|