diff --git a/src/modules/guessing-game/index.ts b/src/modules/guessing-game/index.ts index 5d96c72..a1cc139 100644 --- a/src/modules/guessing-game/index.ts +++ b/src/modules/guessing-game/index.ts @@ -30,24 +30,31 @@ export default class GuessingGameModule implements IModule { isEnded: false }); - if (exist != null) { - msg.reply(serifs.GUESSINGGAME_ARLEADY_STARTED); - } else { - const secret = Math.floor(Math.random() * 100); + if (!msg.isMessage) { + if (exist != null) { + msg.reply(serifs.GUESSINGGAME_ARLEADY_STARTED); + } else { + msg.reply(serifs.GUESSINGGAME_PLZ_DM); + } - guesses.insertOne({ - userId: msg.userId, - secret: secret, - tries: [], - isEnded: false, - startedAt: Date.now(), - endedAt: null - }); - - msg.reply(serifs.GUESSINGGAME_STARTED).then(reply => { - this.ai.subscribeReply(this, msg.userId, msg.isMessage, msg.isMessage ? msg.userId : reply.id); - }); + return true; } + + const secret = Math.floor(Math.random() * 100); + + guesses.insertOne({ + userId: msg.userId, + secret: secret, + tries: [], + isEnded: false, + startedAt: Date.now(), + endedAt: null + }); + + msg.reply(serifs.GUESSINGGAME_STARTED).then(reply => { + this.ai.subscribeReply(this, msg.userId, msg.isMessage, msg.isMessage ? msg.userId : reply.id); + }); + return true; } else { return false; diff --git a/src/serifs.ts b/src/serifs.ts index fb88097..f115d94 100644 --- a/src/serifs.ts +++ b/src/serifs.ts @@ -42,6 +42,11 @@ export default { */ GUESSINGGAME_ARLEADY_STARTED: 'え、ゲームは既に始まってますよ!', + /** + * タイムライン上で数当てゲームに誘われたとき + */ + GUESSINGGAME_PLZ_DM: 'メッセージでやりましょう!', + /** * 数当てゲーム開始 */