数当てゲームはメッセージでのみに

This commit is contained in:
syuilo 2018-08-12 23:25:47 +09:00
parent 24af1d80ae
commit c4610894fb
2 changed files with 28 additions and 16 deletions

View file

@ -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;

View file

@ -42,6 +42,11 @@ export default {
*/
GUESSINGGAME_ARLEADY_STARTED: 'え、ゲームは既に始まってますよ!',
/**
*
*/
GUESSINGGAME_PLZ_DM: 'メッセージでやりましょう!',
/**
*
*/