mirror of
https://github.com/syuilo/ai.git
synced 2024-11-22 05:08:00 +00:00
数当てゲームはメッセージでのみに
This commit is contained in:
parent
24af1d80ae
commit
c4610894fb
|
@ -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;
|
||||
|
|
|
@ -42,6 +42,11 @@ export default {
|
|||
*/
|
||||
GUESSINGGAME_ARLEADY_STARTED: 'え、ゲームは既に始まってますよ!',
|
||||
|
||||
/**
|
||||
* タイムライン上で数当てゲームに誘われたとき
|
||||
*/
|
||||
GUESSINGGAME_PLZ_DM: 'メッセージでやりましょう!',
|
||||
|
||||
/**
|
||||
* 数当てゲーム開始
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue