From ebb8c8c3e0633ddbd4f03d966aa3163bae3a39b6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Mon, 27 Aug 2018 21:49:14 +0900 Subject: [PATCH] nanka iroiro --- src/modules/core/index.ts | 45 +++++++++++++++++++++++++++++++++++---- src/serifs.ts | 6 +++++- torisetu.md | 3 +++ 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/src/modules/core/index.ts b/src/modules/core/index.ts index 322e72f..20900f7 100644 --- a/src/modules/core/index.ts +++ b/src/modules/core/index.ts @@ -23,7 +23,7 @@ export default class CoreModule implements IModule { public onMention = (msg: MessageLike) => { if (!msg.text) return false; - return this.setName(msg) || this.greet(msg); + return this.setName(msg) || this.greet(msg) || this.nadenade(msg) || this.kawaii(msg); } /** @@ -105,13 +105,13 @@ export default class CoreModule implements IModule { const y = now.getFullYear(); const m = now.getMonth(); const d = now.getDate(); - const date = `${y}/${m + 1}/${d}`; + const today = `${y}/${m + 1}/${d}`; const data = msg.friend.getPerModulesData(this); - if (data.lastGreetedAt == date) return; + if (data.lastGreetedAt == today) return; - data.lastGreetedAt = date; + data.lastGreetedAt = today; msg.friend.setPerModulesData(this, data); msg.friend.incLove(); @@ -142,6 +142,43 @@ export default class CoreModule implements IModule { } } + private nadenade = (msg: MessageLike): boolean => { + if (!msg.text) return false; + if (!msg.text.includes('なでなで')) return false; + + const now = new Date(); + const y = now.getFullYear(); + const m = now.getMonth(); + const d = now.getDate(); + const today = `${y}/${m + 1}/${d}`; + + const data = msg.friend.getPerModulesData(this); + + if (data.lastNadenadeAt != today) { + data.lastNadenadeAt = today; + msg.friend.setPerModulesData(this, data); + + msg.friend.incLove(); + } + + msg.reply( + msg.friend.love >= 5 ? serifs.core.nadenade2 : + msg.friend.love >= 10 ? serifs.core.nadenade3 : + serifs.core.nadenade1 + ); + + return true; + } + + private kawaii = (msg: MessageLike): boolean => { + if (!msg.text) return false; + if (!msg.text.includes('かわいい') && !msg.text.includes('可愛い')) return false; + + msg.reply(serifs.core.kawaii); + + return true; + } + public onReplyThisModule = (msg: MessageLike, data: any) => { if (msg.text == null) return; diff --git a/src/serifs.ts b/src/serifs.ts index e3a8d4d..325e3f9 100644 --- a/src/serifs.ts +++ b/src/serifs.ts @@ -10,7 +10,11 @@ export default { tooLong: '長すぎる気がします...', requireMoreLove: 'もっと仲良くなったら考えてあげてもいいですよ?', happyBirthday: 'お誕生日おめでとうございます🎉', - happyBirthdayWithName: 'お誕生日おめでとうございます、{name}🎉' + happyBirthdayWithName: 'お誕生日おめでとうございます、{name}🎉', + nadenade1: '…っ! びっくりしました', + nadenade2: 'わわっ… 恥ずかしいです', + nadenade3: 'ん… ありがとうございます♪', + kawaii: 'ありがとうございます♪' }, keyword: { diff --git a/torisetu.md b/torisetu.md index f6c2a03..857bf2c 100644 --- a/torisetu.md +++ b/torisetu.md @@ -34,6 +34,9 @@ ### HappyBirthday 藍があなたの誕生日を祝ってくれます。 +### なでなで +スキンシップです。 + ## 親愛度 藍はあなたに対する親愛度を持っています。 藍に挨拶したりすると、少しずつ上がっていきます。