@hieuzest/koishi-plugin-mahjongpub 0.1.1 → 0.1.2

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/api.js CHANGED
@@ -15,7 +15,6 @@ class Team {
15
15
  constructor(ctx, pw, options) {
16
16
  this.pw = pw;
17
17
  this.options = options;
18
- console.log('endpoint', options.endpoint);
19
18
  this.http = ctx.http.extend({
20
19
  endpoint: options.endpoint,
21
20
  });
@@ -50,7 +49,6 @@ class Team {
50
49
  };
51
50
  const form = new FormData();
52
51
  Object.entries(payload).forEach(([key, value]) => form.append(key, value));
53
- console.log('payload', payload);
54
52
  return (await this.http.post('/team_post.php', form, { responseType: 'json' }))?.msg;
55
53
  }
56
54
  }
package/lib/index.js CHANGED
@@ -128,10 +128,11 @@ class MahjongPub {
128
128
  const team = new api_1.Team(ctx, pw, config);
129
129
  try {
130
130
  await team.read();
131
- team.players = team.players.map((player, i) => {
132
- const index = indices.indexOf(i + 1);
133
- return index === -1 ? player : team.players[indices[index + (index % 2 === 0 ? 1 : -1)] - 1];
134
- });
131
+ for (let i = 0; i < indices.length; i += 2) {
132
+ const t = team.players[indices[i] - 1];
133
+ team.players[indices[i] - 1] = team.players[indices[i + 1] - 1];
134
+ team.players[indices[i + 1] - 1] = t;
135
+ }
135
136
  return await team.write() ?? session.text('.success', team);
136
137
  }
137
138
  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.1",
4
+ "version": "0.1.2",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [