koishi-plugin-ciyi 0.0.2 → 0.0.3
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.d.ts +1 -0
- package/lib/index.js +10 -4
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -50,6 +50,7 @@ function apply(ctx, cfg) {
|
|
|
50
50
|
answer: "string",
|
|
51
51
|
lastStartTimestamp: "timestamp",
|
|
52
52
|
guessedWords: "list",
|
|
53
|
+
guessedHistoryInOneGame: "list",
|
|
53
54
|
rankList: "list",
|
|
54
55
|
history: { type: "json", initial: [] },
|
|
55
56
|
isOver: "boolean"
|
|
@@ -46743,18 +46744,20 @@ ${formattedRanks}`;
|
|
|
46743
46744
|
if (gameInfo[0].isOver) {
|
|
46744
46745
|
return await sendMsg(session, "今日挑战已结束,请明日再来!");
|
|
46745
46746
|
}
|
|
46746
|
-
if (gameInfo[0].
|
|
46747
|
+
if (gameInfo[0].guessedHistoryInOneGame.includes(guess)) {
|
|
46747
46748
|
return await sendMsg(session, "你已经猜过这个词了!");
|
|
46748
46749
|
}
|
|
46749
46750
|
const rankList = gameInfo[0].rankList;
|
|
46750
46751
|
const history = [...gameInfo[0].history, getHistory(guess, rankList)];
|
|
46751
46752
|
await ctx.database.set("ciyi", { channelId: session.channelId }, {
|
|
46753
|
+
guessedHistoryInOneGame: [...gameInfo[0].guessedHistoryInOneGame, guess],
|
|
46752
46754
|
history
|
|
46753
46755
|
});
|
|
46754
46756
|
if (guess === gameInfo[0].answer) {
|
|
46755
46757
|
await ctx.database.set("ciyi", { channelId: session.channelId }, {
|
|
46756
46758
|
isOver: true,
|
|
46757
|
-
history: []
|
|
46759
|
+
history: [],
|
|
46760
|
+
guessedHistoryInOneGame: []
|
|
46758
46761
|
});
|
|
46759
46762
|
const msg = `恭喜你猜对了!
|
|
46760
46763
|
正确答案:${gameInfo[0].answer}`;
|
|
@@ -46801,7 +46804,8 @@ ${formattedRanks}`;
|
|
|
46801
46804
|
guessedWords: [`${answer}`],
|
|
46802
46805
|
rankList,
|
|
46803
46806
|
history: [],
|
|
46804
|
-
isOver: false
|
|
46807
|
+
isOver: false,
|
|
46808
|
+
guessedHistoryInOneGame: []
|
|
46805
46809
|
});
|
|
46806
46810
|
} else {
|
|
46807
46811
|
await ctx.database.set("ciyi", { channelId: session.channelId }, {
|
|
@@ -46809,7 +46813,9 @@ ${formattedRanks}`;
|
|
|
46809
46813
|
lastStartTimestamp: new Date(timestamp),
|
|
46810
46814
|
guessedWords: [...gameInfo[0].guessedWords, `${answer}`],
|
|
46811
46815
|
rankList,
|
|
46812
|
-
isOver: false
|
|
46816
|
+
isOver: false,
|
|
46817
|
+
guessedHistoryInOneGame: [],
|
|
46818
|
+
history: []
|
|
46813
46819
|
});
|
|
46814
46820
|
}
|
|
46815
46821
|
const msg = `词意每日挑战开始!
|