summaryrefslogtreecommitdiff
path: root/src/api/bot
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-10-08 12:09:10 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-10-08 12:09:10 +0900
commit9f6f616ecc70f065c9739e89cc555ce55980e4ec (patch)
tree2f7961359f94ab637d2d9c4b32dfc6ef1b156657 /src/api/bot
parent:v: (diff)
downloadsharkey-9f6f616ecc70f065c9739e89cc555ce55980e4ec.tar.gz
sharkey-9f6f616ecc70f065c9739e89cc555ce55980e4ec.tar.bz2
sharkey-9f6f616ecc70f065c9739e89cc555ce55980e4ec.zip
:v:
Diffstat (limited to 'src/api/bot')
-rw-r--r--src/api/bot/core.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/api/bot/core.ts b/src/api/bot/core.ts
index d7655f8175..b13402dce9 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) {