From d200b1083dad562c048e857411679a58e69650b6 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 8 Oct 2017 12:09:10 +0900 Subject: [PATCH] :v: --- src/api/bot/core.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api/bot/core.ts b/src/api/bot/core.ts index d7655f817..b13402dce 100644 --- a/src/api/bot/core.ts +++ b/src/api/bot/core.ts @@ -295,11 +295,15 @@ class GuessingGameContext extends Context { return 'やめました。'; } + const guess = parseInt(query, 10); + + if (isNaN(guess)) { + return '整数で推測してください。「やめる」と言うとゲームをやめます。'; + } + this.try++; this.emit('updated'); - const guess = parseInt(query, 10); - if (this.secret < guess) { return `${guess}よりも小さいですね`; } else if (this.secret > guess) {