@hieuzest/koishi-plugin-mahjongpub 0.1.20 → 0.1.22

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 +4 -2
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -402,11 +402,13 @@ var MahjongPub = class {
402
402
  const record = await contest.getRoundRecord(round, cls);
403
403
  if ((0, import_koishi.isNullable)(options.rowi)) {
404
404
  return record.matches.map((match, i) => `[${i}] ` + match.players.map((x) => `${x.name} ${x.point}`).join(" / ")).join("\n");
405
- } else {
405
+ } else if (record.matches.at(options.rowi ?? -1)) {
406
406
  return [
407
407
  `[${options.rowi === -1 ? record.matches.length - 1 : options.rowi}]`,
408
408
  record.matches.at(options.rowi ?? -1).players.map((x) => `${x.name} ${x.point}`).join(" / ")
409
409
  ].join(" ");
410
+ } else {
411
+ return session.text(".failed");
410
412
  }
411
413
  } catch (e) {
412
414
  ctx.logger.warn(e);
@@ -439,7 +441,7 @@ var MahjongPub = class {
439
441
  round,
440
442
  ver: options.ver,
441
443
  ...options.rowi === -1 ? {} : { rowi: options.rowi }
442
- }).sort({ rowi: -1 }).toArray();
444
+ }).sort({ rowi: 1 }).toArray();
443
445
  if (!record.length) return session.text(".failed");
444
446
  return record.map((r) => `[${r.rowi}] ` + r.results.map((x) => `${x.name} ${x.num}`).join(" / ")).join("\n");
445
447
  } catch (e) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hieuzest/koishi-plugin-mahjongpub",
3
3
  "description": "Mahjong.pub API",
4
- "version": "0.1.20",
4
+ "version": "0.1.22",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [