@hieuzest/koishi-plugin-riichi-city 0.5.2 → 0.5.4
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 +6 -2
- package/lib/lobby.js +2 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -79,6 +79,10 @@ ${config.extraHelp}`.trim();
|
|
|
79
79
|
const l = await this.api.listLobbys();
|
|
80
80
|
return Object.values(l).map((x) => `[${x.id}] ${x.name}`).join("\n");
|
|
81
81
|
});
|
|
82
|
+
ctx.command("rc-dhs.info <cid:number>").action(async (_, cid) => {
|
|
83
|
+
const details = await this.api.enterLobby(cid);
|
|
84
|
+
return `${details.matchInfo.name} [${details.classifyID}]`;
|
|
85
|
+
});
|
|
82
86
|
ctx.guild().command("rc-dhs.bind [cid:number]", { admin: { channel: true } }).userFields(["authority"]).channelFields(["rc-dhs/bind"]).action(async ({ session }, cid) => {
|
|
83
87
|
const contestId = session.channel["rc-dhs/bind"];
|
|
84
88
|
if (!cid && contestId) {
|
|
@@ -309,7 +313,7 @@ ${config.extraHelp}`.trim();
|
|
|
309
313
|
} catch (e) {
|
|
310
314
|
if (e instanceof import_lobby.DHSError) throw e;
|
|
311
315
|
else {
|
|
312
|
-
this.ctx.logger.
|
|
316
|
+
this.ctx.logger.warn(e?.message ?? e);
|
|
313
317
|
throw e;
|
|
314
318
|
}
|
|
315
319
|
}
|
|
@@ -350,7 +354,7 @@ ${config.extraHelp}`.trim();
|
|
|
350
354
|
} catch (e) {
|
|
351
355
|
if (e instanceof import_lobby.DHSError) throw e;
|
|
352
356
|
else {
|
|
353
|
-
this.ctx.logger.
|
|
357
|
+
this.ctx.logger.warn(e?.message ?? e);
|
|
354
358
|
throw e;
|
|
355
359
|
}
|
|
356
360
|
}
|
package/lib/lobby.js
CHANGED
|
@@ -181,6 +181,8 @@ var RiichiCityLobby = class {
|
|
|
181
181
|
} else {
|
|
182
182
|
notFound.push(player.pattern);
|
|
183
183
|
}
|
|
184
|
+
} else if (player.accountId) {
|
|
185
|
+
if (!Object.values(onlinePlayers).includes(player.accountId)) notFound.push(player.pattern);
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
if (notFound.length) throw new PlayerNotFoundError(...notFound);
|