koishi-plugin-ciyi 0.0.8 → 1.0.0
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 +9 -8
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -155,17 +155,11 @@ ${formattedRanks}`;
|
|
|
155
155
|
return await sendMsg(session, "请先开始每日挑战!");
|
|
156
156
|
}
|
|
157
157
|
if (gameInfo[0].isOver) {
|
|
158
|
-
return await sendMsg(session, "今日挑战已结束,请明日再来!");
|
|
158
|
+
return await sendMsg(session, isSameDay(session.timestamp, gameInfo[0].lastStartTimestamp) ? "今日挑战已结束,请明日再来!" : "今日挑战还未开始!\n\n发送 ciyi.每日挑战 开始今日的挑战吧~");
|
|
159
159
|
}
|
|
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
|
}
|