Improve AI

This commit is contained in:
syuilo 2018-09-02 10:44:09 +09:00
parent 0133b2f172
commit 5b59823edd
2 changed files with 8 additions and 2 deletions

View file

@ -115,6 +115,8 @@ export default class CoreModule implements IModule {
} }
private greet = (msg: MessageLike): boolean => { private greet = (msg: MessageLike): boolean => {
if (msg.text == null) return false;
const incLove = () => { const incLove = () => {
//#region 1日に1回だけ親愛度を上げる //#region 1日に1回だけ親愛度を上げる
const today = getDate(); const today = getDate();
@ -130,6 +132,10 @@ export default class CoreModule implements IModule {
//#endregion //#endregion
}; };
const tension = (msg.text.match(/[!]{2,}/g) || [])
.sort((a, b) => a.length < b.length ? 1 : -1)[0]
.substr(1);
if (includes(msg.text, ['こんにちは', 'こんにちわ'])) { if (includes(msg.text, ['こんにちは', 'こんにちわ'])) {
msg.reply(serifs.core.hello(msg.friend.name)); msg.reply(serifs.core.hello(msg.friend.name));
incLove(); incLove();
@ -143,7 +149,7 @@ export default class CoreModule implements IModule {
} }
if (includes(msg.text, ['おは', 'お早う'])) { if (includes(msg.text, ['おは', 'お早う'])) {
msg.reply(serifs.core.goodMorning(msg.friend.name)); msg.reply(serifs.core.goodMorning(tension, msg.friend.name));
incLove(); incLove();
return true; return true;
} }

View file

@ -10,7 +10,7 @@ export default {
helloNight: name => name ? `こんばんは、${name}` : `こんばんは♪`, helloNight: name => name ? `こんばんは、${name}` : `こんばんは♪`,
goodMorning: name => name ? `おはようございます、${name}` : 'おはようございます!', goodMorning: (tension, name) => name ? `おはようございます、${name}${tension}` : `おはようございます!${tension}`,
goodNight: name => name ? `おやすみなさい、${name}` : 'おやすみなさい!', goodNight: name => name ? `おやすみなさい、${name}` : 'おやすみなさい!',