@hieuzest/koishi-plugin-mahjongpub 0.3.7 → 0.3.8
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.d.ts +1 -0
- package/lib/index.js +16 -3
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ declare module 'koishi' {
|
|
|
16
16
|
'mahjongpub/bind-team': string;
|
|
17
17
|
'mahjongpub/bind-contest': string;
|
|
18
18
|
'mahjongpub/bind-contestpw': string;
|
|
19
|
+
'mahjongpub/bind-contesteditrow': number;
|
|
19
20
|
}
|
|
20
21
|
interface Tables {
|
|
21
22
|
'mahjongpub.contests': ConsoleExtension.ContestConfig;
|
package/lib/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
23
23
|
// src/locales/zh-CN.yml
|
|
24
24
|
var require_zh_CN = __commonJS({
|
|
25
25
|
"src/locales/zh-CN.yml"(exports2, module2) {
|
|
26
|
-
module2.exports = { commands: { "mahjongpub.team.bind": { description: "绑定队伍", messages: { failed: "绑定失败", success: "成功: [{cid}:{tid}] {name}" } }, "mahjongpub.team.unbind": { description: "解除绑定", messages: { notbind: "未绑定", success: "成功" } }, "mahjongpub.team.password": { description: "查看密码", messages: { notbind: "未绑定", output: "密码: {0}" } }, "mahjongpub.team.stats": { description: "查看队伍信息", messages: { notbind: "未绑定", failed: "失败", output: "- [{cid}:{tid}] {name}\n{players.map((p, i) => '' + (i+1) + ': ' + p).join('\\n')}\n" } }, "mahjongpub.team.desc": { description: "队伍简介", messages: { notbind: "未绑定", failed: "失败", output: "- [{cid}:{tid}] {name}\n{description}\n" } }, "mahjongpub.team.logo": { description: "队伍头像", messages: { notbind: "未绑定", failed: "失败" } }, "mahjongpub.team.add": { description: "添加队员", messages: { notbind: "未绑定", failed: "失败", success: "- [{cid}:{tid}] {name}\n{players.map((p, i) => '' + (i+1) + ': ' + p).join('\\n')}\n" } }, "mahjongpub.team.remove": { description: "删除队员", messages: { notbind: "未绑定", failed: "失败", success: "- [{cid}:{tid}] {name}\n{players.map((p, i) => '' + (i+1) + ': ' + p).join('\\n')}\n" } }, "mahjongpub.team.swap": { description: "交换队员", messages: { notbind: "未绑定", failed: "失败", invalid: "参数错误", "wide-range": "范围过大", success: "- [{cid}:{tid}] {name}\n{players.map((p, i) => '' + (i+1) + ': ' + p).join('\\n')}\n" } }, "mahjongpub.contest.bind": { description: "绑定比赛", messages: { failed: "绑定失败", success: "成功: [{cid}] {name}" } }, "mahjongpub.contest.password": { description: "查看密码", messages: { failed: "未绑定", success: "[{0}] {1}\n" } }, "mahjongpub.contest.record.get": { description: "查询比赛记录", messages: { failed: "查询失败" } }, "mahjongpub.contest.record.update": { description: "修改比赛记录", messages: { failed: "修改失败" } }, "mahjongpub.database.record.get": { description: "查询比赛记录", messages: { failed: "查询失败" } }, "mahjongpub.database.record.update": { description: "修改比赛记录", messages: { success: "修改成功", failed: "修改失败", unmodified: "未修改" } } } };
|
|
26
|
+
module2.exports = { commands: { "mahjongpub.team.bind": { description: "绑定队伍", messages: { failed: "绑定失败", success: "成功: [{cid}:{tid}] {name}" } }, "mahjongpub.team.unbind": { description: "解除绑定", messages: { notbind: "未绑定", success: "成功" } }, "mahjongpub.team.password": { description: "查看密码", messages: { notbind: "未绑定", output: "密码: {0}" } }, "mahjongpub.team.stats": { description: "查看队伍信息", messages: { notbind: "未绑定", failed: "失败", output: "- [{cid}:{tid}] {name}\n{players.map((p, i) => '' + (i+1) + ': ' + p).join('\\n')}\n" } }, "mahjongpub.team.desc": { description: "队伍简介", messages: { notbind: "未绑定", failed: "失败", output: "- [{cid}:{tid}] {name}\n{description}\n" } }, "mahjongpub.team.logo": { description: "队伍头像", messages: { notbind: "未绑定", failed: "失败" } }, "mahjongpub.team.add": { description: "添加队员", messages: { notbind: "未绑定", failed: "失败", success: "- [{cid}:{tid}] {name}\n{players.map((p, i) => '' + (i+1) + ': ' + p).join('\\n')}\n" } }, "mahjongpub.team.remove": { description: "删除队员", messages: { notbind: "未绑定", failed: "失败", success: "- [{cid}:{tid}] {name}\n{players.map((p, i) => '' + (i+1) + ': ' + p).join('\\n')}\n" } }, "mahjongpub.team.swap": { description: "交换队员", messages: { notbind: "未绑定", failed: "失败", invalid: "参数错误", "wide-range": "范围过大", unauthorized: "无权限", success: "- [{cid}:{tid}] {name}\n{players.map((p, i) => '' + (i+1) + ': ' + p).join('\\n')}\n" } }, "mahjongpub.contest.bind": { description: "绑定比赛", messages: { failed: "绑定失败", success: "成功: [{cid}] {name}" } }, "mahjongpub.contest.password": { description: "查看密码", messages: { failed: "未绑定", success: "[{0}] {1}\n" } }, "mahjongpub.contest.record.get": { description: "查询比赛记录", messages: { failed: "查询失败" } }, "mahjongpub.contest.record.update": { description: "修改比赛记录", messages: { failed: "修改失败" } }, "mahjongpub.database.record.get": { description: "查询比赛记录", messages: { failed: "查询失败" } }, "mahjongpub.database.record.update": { description: "修改比赛记录", messages: { success: "修改成功", failed: "修改失败", unmodified: "未修改" } } } };
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
|
|
@@ -1325,7 +1325,8 @@ var MahjongPub2 = class extends import_koishi4.Service {
|
|
|
1325
1325
|
ctx.model.extend("channel", {
|
|
1326
1326
|
"mahjongpub/bind-team": "string",
|
|
1327
1327
|
"mahjongpub/bind-contest": "string",
|
|
1328
|
-
"mahjongpub/bind-contestpw": "string"
|
|
1328
|
+
"mahjongpub/bind-contestpw": "string",
|
|
1329
|
+
"mahjongpub/bind-contesteditrow": { type: "unsigned", initial: 0 }
|
|
1329
1330
|
});
|
|
1330
1331
|
ctx.model.extend("mahjongpub.contests", {
|
|
1331
1332
|
cid: "unsigned",
|
|
@@ -1475,8 +1476,20 @@ var MahjongPub2 = class extends import_koishi4.Service {
|
|
|
1475
1476
|
return session.text(".failed");
|
|
1476
1477
|
}
|
|
1477
1478
|
});
|
|
1478
|
-
ctx.command("mahjongpub.team.swap <...indices:natural>", { authority:
|
|
1479
|
+
ctx.command("mahjongpub.team.swap <...indices:natural>", { authority: 1 }).alias("!交换", "!交换").option("channel", "-c <channel:channel>").option("team", "-t <team:string>").option("start", "-s <start:number>").option("end", "-e <end:number>").option("slim", "--slim").userFields(["mahjongpub/bind-team", "mahjongpub/bind-teams", "authority"]).channelFields(["mahjongpub/bind-team", "mahjongpub/bind-contest", "mahjongpub/bind-contestpw", "mahjongpub/bind-contesteditrow"]).action(async ({ session, options }, ...indices) => {
|
|
1479
1480
|
let pw = options.channel ? (await session.getChannel(parsePlatform(options.channel)[1], ["mahjongpub/bind-team"]))["mahjongpub/bind-team"] : session.isDirect ? session.user["mahjongpub/bind-team"] : session.channel["mahjongpub/bind-team"] ?? session.user["mahjongpub/bind-team"];
|
|
1481
|
+
if (session.user.authority < 3 && (!pw || options.team || options.start || options.end)) {
|
|
1482
|
+
return session.text(".unauthorized");
|
|
1483
|
+
}
|
|
1484
|
+
if (session.user.authority < 3) {
|
|
1485
|
+
const maxEditRow = session.channel?.["mahjongpub/bind-contesteditrow"] || 0;
|
|
1486
|
+
if (maxEditRow && indices.some((i) => i > maxEditRow)) {
|
|
1487
|
+
return session.text(".unauthorized");
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
if (!pw && !options.team && session.author?.nick) {
|
|
1491
|
+
options.team = session.author.nick.split(/[\s+\-]/)[0];
|
|
1492
|
+
}
|
|
1480
1493
|
if (options.team) {
|
|
1481
1494
|
const [cid, cpw] = [session.channel["mahjongpub/bind-contest"], session.channel["mahjongpub/bind-contestpw"]];
|
|
1482
1495
|
if (!cid || !cpw) return session.text(".notbind");
|