mirror of
https://github.com/syuilo/ai.git
synced 2024-11-22 05:08:00 +00:00
✌️
This commit is contained in:
parent
ab4fbb2e33
commit
3d10634bcd
|
@ -46,7 +46,7 @@ export default class 藍 {
|
|||
|
||||
public friends: loki.Collection<FriendDoc>;
|
||||
|
||||
constructor(account: User, ready?: Function) {
|
||||
constructor(account: User, ready: (run: Function) => void) {
|
||||
this.account = account;
|
||||
|
||||
this.db = new loki('memory.json', {
|
||||
|
@ -57,7 +57,7 @@ export default class 藍 {
|
|||
if (err) {
|
||||
this.log(chalk.red(`Failed to load DB: ${err}`));
|
||||
} else {
|
||||
if (ready) ready();
|
||||
ready(this.run);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -69,7 +69,7 @@ export default class 藍 {
|
|||
}
|
||||
|
||||
@autobind
|
||||
public run() {
|
||||
private run() {
|
||||
//#region Init DB
|
||||
this.contexts = getCollection(this.db, 'contexts', {
|
||||
indices: ['key']
|
||||
|
|
|
@ -40,8 +40,7 @@ promiseRetry(retry => {
|
|||
|
||||
log('Starting AiOS...');
|
||||
|
||||
const ai = new 藍(account);
|
||||
|
||||
const ai = new 藍(account, run => {
|
||||
new EmojiModule(ai);
|
||||
new FortuneModule(ai);
|
||||
new GuessingGameModule(ai);
|
||||
|
@ -57,7 +56,8 @@ promiseRetry(retry => {
|
|||
new ValentineModule(ai);
|
||||
if (config.keywordEnabled) new KeywordModule(ai);
|
||||
|
||||
ai.run();
|
||||
run();
|
||||
});
|
||||
}).catch(e => {
|
||||
log(chalk.red('Failed to fetch the account'));
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue