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

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 isEnded: false
}); });
if (exist != null) { if (!msg.isMessage) {
msg.reply(serifs.GUESSINGGAME_ARLEADY_STARTED); if (exist != null) {
} else { msg.reply(serifs.GUESSINGGAME_ARLEADY_STARTED);
const secret = Math.floor(Math.random() * 100); } else {
msg.reply(serifs.GUESSINGGAME_PLZ_DM);
}
guesses.insertOne({ return true;
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);
});
} }
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; return true;
} else { } else {
return false; return false;

View file

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