From a5232195dc800f16d5b14f25501c547b5111a2c6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 27 Jun 2019 14:54:09 +0900 Subject: [PATCH] more erait --- src/modules/core/index.ts | 8 +++++++- src/serifs.ts | 24 +++++++++++++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/modules/core/index.ts b/src/modules/core/index.ts index 8926ff9..ace764d 100644 --- a/src/modules/core/index.ts +++ b/src/modules/core/index.ts @@ -156,9 +156,15 @@ export default class extends Module { @autobind private erait(msg: Message): boolean { + const match = msg.extractedText.match(/(.+?)たから褒めて/); + if (match) { + msg.reply(getSerif(serifs.core.erait.specify(match[1], msg.friend.name))); + return true; + } + if (!msg.includes(['褒めて'])) return false; - msg.reply(getSerif(serifs.core.erait(msg.friend.name))); + msg.reply(getSerif(serifs.core.erait.general(msg.friend.name))); return true; } diff --git a/src/serifs.ts b/src/serifs.ts index 0bb40d8..ef76bef 100644 --- a/src/serifs.ts +++ b/src/serifs.ts @@ -26,13 +26,23 @@ export default { omedeto: name => name ? `ありがとうございます、${name}♪` : 'ありがとうございます♪', - erait: name => name ? [ - `${name}、今日もえらいです!`, - `${name}、今日もえらいですよ~♪` - ] : [ - `今日もえらいです!`, - `今日もえらいですよ~♪` - ], + erait: { + general: name => name ? [ + `${name}、今日もえらいです!`, + `${name}、今日もえらいですよ~♪` + ] : [ + `今日もえらいです!`, + `今日もえらいですよ~♪` + ], + + specify: (thing, name) => name ? [ + `${name}、${thing}てえらいです!`, + `${name}、${thing}てえらいですよ~♪` + ] : [ + `${thing}てえらいです!`, + `${thing}てえらいですよ~♪` + ], + }, okaeri: { love: name => name ? [