diff --git a/src/core/controller.ts b/src/core/controller.ts index e28f57e..b81c702 100644 --- a/src/core/controller.ts +++ b/src/core/controller.ts @@ -106,7 +106,7 @@ function runActions(bot: YveBot, rule: IRule, prop: string): Promise { } function getNextFromRule(rule: IRule, answer?: Answer | Answer[]): RuleNext | null { - if (rule.options.length && answer) { + if (rule.options.length && answer !== undefined) { const option = utils.findOptionByAnswer(rule.options, answer); if (option && option.next) { return option.next; @@ -290,6 +290,7 @@ export class Controller { public jumpByName(ruleName: string): Promise { const idx = this._indexes[ruleName]; + console.log(idx); if (typeof idx !== 'number') { throw new this.bot.exceptions.RuleNotFound(ruleName, this._indexes); } @@ -299,6 +300,7 @@ export class Controller { public nextRule(currentRule: IRule, answer?: Answer | Answer[]): this { const { bot } = this; const nextRuleName = getNextFromRule(currentRule, answer); + console.log(nextRuleName); if (nextRuleName) { let ruleName; if (/flow:/.test(nextRuleName)) { // jump to flow