This commit is contained in:
syuilo 2019-01-15 10:23:54 +09:00
parent ab4fbb2e33
commit 3d10634bcd
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
2 changed files with 20 additions and 20 deletions

View file

@ -46,7 +46,7 @@ export default class 藍 {
public friends: loki.Collection<FriendDoc>; public friends: loki.Collection<FriendDoc>;
constructor(account: User, ready?: Function) { constructor(account: User, ready: (run: Function) => void) {
this.account = account; this.account = account;
this.db = new loki('memory.json', { this.db = new loki('memory.json', {
@ -57,7 +57,7 @@ export default class 藍 {
if (err) { if (err) {
this.log(chalk.red(`Failed to load DB: ${err}`)); this.log(chalk.red(`Failed to load DB: ${err}`));
} else { } else {
if (ready) ready(); ready(this.run);
} }
} }
}); });
@ -69,7 +69,7 @@ export default class 藍 {
} }
@autobind @autobind
public run() { private run() {
//#region Init DB //#region Init DB
this.contexts = getCollection(this.db, 'contexts', { this.contexts = getCollection(this.db, 'contexts', {
indices: ['key'] indices: ['key']

View file

@ -40,24 +40,24 @@ promiseRetry(retry => {
log('Starting AiOS...'); log('Starting AiOS...');
const ai = new (account); const ai = new (account, run => {
new EmojiModule(ai);
new FortuneModule(ai);
new GuessingGameModule(ai);
new ReversiModule(ai);
new TimerModule(ai);
new DiceModule(ai);
new CoreModule(ai);
new PingModule(ai);
new WelcomeModule(ai);
new ServerModule(ai);
new FollowModule(ai);
new BirthdayModule(ai);
new ValentineModule(ai);
if (config.keywordEnabled) new KeywordModule(ai);
new EmojiModule(ai); run();
new FortuneModule(ai); });
new GuessingGameModule(ai);
new ReversiModule(ai);
new TimerModule(ai);
new DiceModule(ai);
new CoreModule(ai);
new PingModule(ai);
new WelcomeModule(ai);
new ServerModule(ai);
new FollowModule(ai);
new BirthdayModule(ai);
new ValentineModule(ai);
if (config.keywordEnabled) new KeywordModule(ai);
ai.run();
}).catch(e => { }).catch(e => {
log(chalk.red('Failed to fetch the account')); log(chalk.red('Failed to fetch the account'));
}); });