koishi-plugin-ciyi 0.0.8 → 0.0.9
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 -7
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -160,12 +160,6 @@ ${formattedRanks}`;
|
|
|
160
160
|
if (gameInfo[0].guessedHistoryInOneGame.includes(guess)) {
|
|
161
161
|
return await sendMsg(session, "你已经猜过这个词了!");
|
|
162
162
|
}
|
|
163
|
-
const rankList = gameInfo[0].rankList;
|
|
164
|
-
const history = [...gameInfo[0].history, getHistory(guess, rankList)];
|
|
165
|
-
await ctx.database.set("ciyi", { channelId: session.channelId }, {
|
|
166
|
-
guessedHistoryInOneGame: [...gameInfo[0].guessedHistoryInOneGame, guess],
|
|
167
|
-
history
|
|
168
|
-
});
|
|
169
163
|
if (guess === gameInfo[0].answer) {
|
|
170
164
|
await ctx.database.set("ciyi", { channelId: session.channelId }, {
|
|
171
165
|
isOver: true,
|
|
@@ -173,7 +167,8 @@ ${formattedRanks}`;
|
|
|
173
167
|
guessedHistoryInOneGame: []
|
|
174
168
|
});
|
|
175
169
|
const msg = `恭喜你猜对了!
|
|
176
|
-
正确答案:${gameInfo[0].answer}
|
|
170
|
+
正确答案:${gameInfo[0].answer}
|
|
171
|
+
猜测次数:${gameInfo[0].history.length + 1} 次`;
|
|
177
172
|
const playerInfo = await ctx.database.get("ciyi_rank", { userId: session.userId });
|
|
178
173
|
if (playerInfo.length === 0) {
|
|
179
174
|
await ctx.database.create("ciyi_rank", {
|
|
@@ -189,6 +184,12 @@ ${formattedRanks}`;
|
|
|
189
184
|
}
|
|
190
185
|
return await sendMsg(session, msg);
|
|
191
186
|
}
|
|
187
|
+
const rankList = gameInfo[0].rankList;
|
|
188
|
+
const history = [...gameInfo[0].history, getHistory(guess, rankList)];
|
|
189
|
+
await ctx.database.set("ciyi", { channelId: session.channelId }, {
|
|
190
|
+
guessedHistoryInOneGame: [...gameInfo[0].guessedHistoryInOneGame, guess],
|
|
191
|
+
history
|
|
192
|
+
});
|
|
192
193
|
const historyString = formatHistories(history);
|
|
193
194
|
return await sendMsg(session, historyString);
|
|
194
195
|
}
|