koishi-plugin-ciyi 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +8 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -46743,6 +46743,9 @@ ${formattedRanks}`;
|
|
|
46743
46743
|
if (gameInfo[0].isOver) {
|
|
46744
46744
|
return await sendMsg(session, "今日挑战已结束,请明日再来!");
|
|
46745
46745
|
}
|
|
46746
|
+
if (gameInfo[0].guessedWords.includes(guess)) {
|
|
46747
|
+
return await sendMsg(session, "你已经猜过这个词了!");
|
|
46748
|
+
}
|
|
46746
46749
|
const rankList = gameInfo[0].rankList;
|
|
46747
46750
|
const history = [...gameInfo[0].history, getHistory(guess, rankList)];
|
|
46748
46751
|
await ctx.database.set("ciyi", { channelId: session.channelId }, {
|
|
@@ -46750,7 +46753,8 @@ ${formattedRanks}`;
|
|
|
46750
46753
|
});
|
|
46751
46754
|
if (guess === gameInfo[0].answer) {
|
|
46752
46755
|
await ctx.database.set("ciyi", { channelId: session.channelId }, {
|
|
46753
|
-
isOver: true
|
|
46756
|
+
isOver: true,
|
|
46757
|
+
history: []
|
|
46754
46758
|
});
|
|
46755
46759
|
const msg = `恭喜你猜对了!
|
|
46756
46760
|
正确答案:${gameInfo[0].answer}`;
|
|
@@ -46780,6 +46784,9 @@ ${formattedRanks}`;
|
|
|
46780
46784
|
if (isSameDay(timestamp, gameInfo[0].lastStartTimestamp)) {
|
|
46781
46785
|
return await sendMsg(session, "今日挑战已经开始,请明日再来!");
|
|
46782
46786
|
}
|
|
46787
|
+
if (!gameInfo[0].isOver) {
|
|
46788
|
+
return await sendMsg(session, "还有未完成的挑战,请完成后再来!");
|
|
46789
|
+
}
|
|
46783
46790
|
}
|
|
46784
46791
|
let answer = random.pick(questionList);
|
|
46785
46792
|
while (!isNone && gameInfo[0].guessedWords.includes(answer)) {
|