Improve AI

This commit is contained in:
syuilo 2018-09-02 22:34:17 +09:00
parent 2894d45aa7
commit 5c45354073
2 changed files with 22 additions and 15 deletions

View file

@ -24,14 +24,20 @@ export default class TimerModule implements IModule {
if ((seconds + minutes + hours) == 0) { if ((seconds + minutes + hours) == 0) {
msg.reply(serifs.timer.invalid); msg.reply(serifs.timer.invalid);
return true; return true;
} else { }
msg.reply(serifs.timer.set);
const time = const time =
(1000 * seconds) + (1000 * seconds) +
(1000 * 60 * minutes) + (1000 * 60 * minutes) +
(1000 * 60 * 60 * hours); (1000 * 60 * 60 * hours);
if (time > 86400000) {
msg.reply(serifs.timer.tooLong);
return true;
}
msg.reply(serifs.timer.set);
const str = `${hours ? hoursQuery[0] : ''}${minutes ? minutesQuery[0] : ''}${seconds ? secondsQuery[0] : ''}`; const str = `${hours ? hoursQuery[0] : ''}${minutes ? minutesQuery[0] : ''}${seconds ? secondsQuery[0] : ''}`;
setTimeout(() => { setTimeout(() => {
@ -42,7 +48,6 @@ export default class TimerModule implements IModule {
}, time); }, time);
return true; return true;
}
} else { } else {
return false; return false;
} }

View file

@ -217,6 +217,8 @@ export default {
invalid: 'うーん...', invalid: 'うーん...',
tooLong: '長すぎます…',
notify: (time, name) => name ? `${name}${time}経ちましたよ!` : `${time}経ちましたよ!` notify: (time, name) => name ? `${name}${time}経ちましたよ!` : `${time}経ちましたよ!`
} }
}; };