koishi-plugin-wordle-game 2.1.9 → 2.2.1

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.
Files changed (2) hide show
  1. package/lib/index.js +12 -3
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1731,9 +1731,13 @@ ${rankType.map((type, index) => `${index + 1}. ${type}`).join('\n')}
1731
1731
  if (typeof number !== 'number' || isNaN(number) || number < 0) {
1732
1732
  return '请输入大于等于 0 的数字作为排行榜的参数。';
1733
1733
  }
1734
- const rankType3 = [
1735
- "胜场", "输场", "最快用时"
1736
- ];
1734
+ let rankType3;
1735
+ if (type === '总') {
1736
+ rankType3 = ["胜场", "输场"];
1737
+ }
1738
+ else {
1739
+ rankType3 = ["胜场", "输场", "最快用时"];
1740
+ }
1737
1741
  await sendMessage(session, `当前可查看排行榜如下:
1738
1742
  ${rankType3.map((type, index) => `${index + 1}. ${type}`).join('\n')}
1739
1743
  请输入想要查看的【类型名】或【序号】:`);
@@ -1863,6 +1867,7 @@ ${rankType3.map((type, index) => `${index + 1}. ${type}`).join('\n')}
1863
1867
  await page.setContent(html, { waitUntil: 'load' });
1864
1868
  const imageBuffer = await page.screenshot({ fullPage: true, type: config.imageType });
1865
1869
  await page.close();
1870
+ await context.close();
1866
1871
  return imageBuffer;
1867
1872
  }
1868
1873
  async function deductMoney(channelId, platform) {
@@ -1962,6 +1967,7 @@ ${rankType3.map((type, index) => `${index + 1}. ${type}`).join('\n')}
1962
1967
  await page.setContent(html, { waitUntil: 'load' });
1963
1968
  const wordlesImageBuffer = await page.screenshot({ fullPage: true, type: config.imageType });
1964
1969
  await page.close();
1970
+ await context.close();
1965
1971
  return wordlesImageBuffer;
1966
1972
  }
1967
1973
  async function getLeaderboardWinOrLose(type, number, statKey, label) {
@@ -2500,6 +2506,7 @@ ${rankType3.map((type, index) => `${index + 1}. ${type}`).join('\n')}
2500
2506
  await page.setContent(html, { waitUntil: 'load' });
2501
2507
  const imageBuffer = await page.screenshot({ fullPage: true, type: config.imageType });
2502
2508
  await page.close();
2509
+ await context.close();
2503
2510
  return imageBuffer;
2504
2511
  }
2505
2512
  async function generateImageForCiying(gridHtml, rowNum) {
@@ -2544,6 +2551,7 @@ ${gridHtml}
2544
2551
  await page.setContent(html, { waitUntil: 'load' });
2545
2552
  const imageBuffer = await page.screenshot({ fullPage: true, type: config.imageType });
2546
2553
  await page.close();
2554
+ await context.close();
2547
2555
  return imageBuffer;
2548
2556
  }
2549
2557
  async function generateImageForHandle(gridHtml) {
@@ -2578,6 +2586,7 @@ ${gridHtml}
2578
2586
  await page.setContent(html, { waitUntil: 'load' });
2579
2587
  const imageBuffer = await page.screenshot({ fullPage: true, type: config.imageType });
2580
2588
  await page.close();
2589
+ await context.close();
2581
2590
  return imageBuffer;
2582
2591
  }
2583
2592
  async function getPlayerUid(platform, userId) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-wordle-game",
3
3
  "description": "欢迎来到 [Wordle](https://www.nytimes.com/games/wordle/index.html) | [汉兜](https://handle.antfu.me/) | [词影](https://cy.surprising.studio/) |... 猜单词|猜成语|猜数字|猜数学方程式|... 的小游戏,包含多种词库、多种主题、多种游戏设置和排行榜系统。",
4
- "version": "2.1.9",
4
+ "version": "2.2.1",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [