From 668ea62724961ce9d5e5e64fc2852afad74116bc Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 27 Aug 2018 18:54:03 +0900 Subject: [PATCH] Refactor --- src/modules/core/index.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/core/index.ts b/src/modules/core/index.ts index 697b88b..b668abd 100644 --- a/src/modules/core/index.ts +++ b/src/modules/core/index.ts @@ -13,7 +13,9 @@ export default class CoreModule implements IModule { } public onMention = (msg: MessageLike) => { - if (msg.text && msg.text.includes('って呼んで') && !msg.text.startsWith('って呼んで')) { + if (!msg.text) return false; + + if (msg.text.includes('って呼んで') && !msg.text.startsWith('って呼んで')) { let friend = this.ai.friends.findOne({ userId: msg.userId }); @@ -52,7 +54,7 @@ export default class CoreModule implements IModule { } return true; - } else if (msg.text && msg.text.includes('おはよう')) { + } else if (msg.text.includes('おはよう')) { const friend = this.ai.friends.findOne({ userId: msg.userId }); @@ -64,7 +66,7 @@ export default class CoreModule implements IModule { } return true; - } else if (msg.text && msg.text.includes('おやすみ')) { + } else if (msg.text.includes('おやすみ')) { const friend = this.ai.friends.findOne({ userId: msg.userId });