From cac1badb9863cd0c4efe0bca5f5d76c2d8c805b1 Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 15 Jan 2019 18:34:42 +0900 Subject: [PATCH] Improve readability --- src/ai.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ai.ts b/src/ai.ts index b800eb9..d81e046 100644 --- a/src/ai.ts +++ b/src/ai.ts @@ -128,7 +128,10 @@ export default class 藍 { private onMention(msg: MessageLike) { this.log(chalk.gray(`<<< An message received: ${chalk.underline(msg.id)}`)); - const context = !msg.isMessage && msg.replyId == null ? null : this.contexts.findOne(msg.isMessage ? { + const isNoContext = !msg.isMessage && msg.replyId == null; + + // Look up the context + const context = isNoContext ? null : this.contexts.findOne(msg.isMessage ? { isMessage: true, userId: msg.userId } : {