@hieuzest/koishi-plugin-riichi-city 0.4.5 → 0.4.7
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.d.ts +1 -1
- package/lib/api.js +2 -2
- package/lib/index.js +4 -3
- package/package.json +1 -1
package/lib/api.d.ts
CHANGED
|
@@ -95,7 +95,7 @@ export declare class RiichiCityApi {
|
|
|
95
95
|
limit?: number;
|
|
96
96
|
skip?: number;
|
|
97
97
|
}): Promise<types.Paipu[]>;
|
|
98
|
-
getRoomData(roomId: string): Promise<types.RoomData>;
|
|
98
|
+
getRoomData(roomId: string, isObserve?: boolean): Promise<types.RoomData>;
|
|
99
99
|
getGameData(roomId: string, eventStartPos: number): Promise<types.GameData>;
|
|
100
100
|
}
|
|
101
101
|
export declare namespace RiichiCityApi {
|
package/lib/api.js
CHANGED
|
@@ -284,8 +284,8 @@ var RiichiCityApi = class _RiichiCityApi {
|
|
|
284
284
|
const res = await this.post("/record/readPaiPuList", { limit, skip, ...options });
|
|
285
285
|
return res.data;
|
|
286
286
|
}
|
|
287
|
-
async getRoomData(roomId) {
|
|
288
|
-
const res = await this.post("/record/getRoomData", { isObserve
|
|
287
|
+
async getRoomData(roomId, isObserve = true) {
|
|
288
|
+
const res = await this.post("/record/getRoomData", { isObserve, keyValue: roomId });
|
|
289
289
|
return res.data;
|
|
290
290
|
}
|
|
291
291
|
async getGameData(roomId, eventStartPos) {
|
package/lib/index.js
CHANGED
|
@@ -439,7 +439,8 @@ var RiichiCity = class extends import_koishi3.Service {
|
|
|
439
439
|
nickname: "string",
|
|
440
440
|
updatedAt: "unsigned"
|
|
441
441
|
}, {
|
|
442
|
-
primary: "userId"
|
|
442
|
+
primary: "userId",
|
|
443
|
+
indexes: ["nickname"]
|
|
443
444
|
});
|
|
444
445
|
this.api = new import_api2.RiichiCityApi(ctx, config);
|
|
445
446
|
ctx.on("ready", async () => {
|
|
@@ -453,7 +454,7 @@ var RiichiCity = class extends import_koishi3.Service {
|
|
|
453
454
|
}
|
|
454
455
|
api;
|
|
455
456
|
async getAccountsByNicknames(nicknames, query = true) {
|
|
456
|
-
const curtime = Date.now() / 1e3;
|
|
457
|
+
const curtime = Math.floor(Date.now() / 1e3);
|
|
457
458
|
const list = await this.ctx.database.select("riichi-city.accounts", { nickname: nicknames }).groupBy("nickname", {
|
|
458
459
|
accounts: /* @__PURE__ */ __name((row) => import_koishi3.$.array(import_koishi3.$.object(row)), "accounts")
|
|
459
460
|
}).execute();
|
|
@@ -478,7 +479,7 @@ var RiichiCity = class extends import_koishi3.Service {
|
|
|
478
479
|
return res;
|
|
479
480
|
}
|
|
480
481
|
async setAccounts(accounts) {
|
|
481
|
-
const curtime = Date.now() / 1e3;
|
|
482
|
+
const curtime = Math.floor(Date.now() / 1e3);
|
|
482
483
|
accounts = accounts.map((x) => ({ updatedAt: curtime, ...x }));
|
|
483
484
|
await this.ctx.database.upsert("riichi-city.accounts", accounts);
|
|
484
485
|
}
|