@hieuzest/koishi-plugin-mahjongpub 0.1.10 → 0.1.12
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 +21 -2
- package/lib/locales/zh-CN.json +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -158,7 +158,7 @@ class MahjongPub {
|
|
|
158
158
|
return session.text('.failed');
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
|
-
ctx.command('mahjongpub.team.add <...users:string>')
|
|
161
|
+
ctx.command('mahjongpub.team.add <...users:string>', { authority: 3 })
|
|
162
162
|
.alias('!添加', '!添加')
|
|
163
163
|
.option('channel', '-c <channel:channel>')
|
|
164
164
|
.option('team', '-t <team:string>')
|
|
@@ -190,7 +190,7 @@ class MahjongPub {
|
|
|
190
190
|
return session.text('.failed');
|
|
191
191
|
}
|
|
192
192
|
});
|
|
193
|
-
ctx.command('mahjongpub.team.remove <...indices:natural>')
|
|
193
|
+
ctx.command('mahjongpub.team.remove <...indices:natural>', { authority: 3 })
|
|
194
194
|
.alias('!删除', '!删除')
|
|
195
195
|
.option('channel', '-c <channel:channel>')
|
|
196
196
|
.option('team', '-t <team:string>')
|
|
@@ -227,6 +227,8 @@ class MahjongPub {
|
|
|
227
227
|
.alias('!交换', '!交换')
|
|
228
228
|
.option('channel', '-c <channel:channel>')
|
|
229
229
|
.option('team', '-t <team:string>')
|
|
230
|
+
.option('start', '-s <start:number>')
|
|
231
|
+
.option('end', '-e <end:number>')
|
|
230
232
|
.userFields(['mahjongpub/bind-team', 'mahjongpub/bind-teams'])
|
|
231
233
|
.channelFields(['mahjongpub/bind-team', 'mahjongpub/bind-contest', 'mahjongpub/bind-contestpw'])
|
|
232
234
|
.action(async ({ session, options }, ...indices) => {
|
|
@@ -240,6 +242,22 @@ class MahjongPub {
|
|
|
240
242
|
await contest.read();
|
|
241
243
|
pw = (contest.teams[options.team] ?? Object.values(contest.teams).find(t => t.name === options.team))?.pw;
|
|
242
244
|
}
|
|
245
|
+
else if (options.start && options.end) {
|
|
246
|
+
if (options.end - options.start > 100)
|
|
247
|
+
return session.text('.wide-range');
|
|
248
|
+
for (let tid = options.start; tid <= options.end; tid++) {
|
|
249
|
+
await session.execute({
|
|
250
|
+
name: 'mahjongpub.team.swap',
|
|
251
|
+
args: indices,
|
|
252
|
+
options: {
|
|
253
|
+
channel: options.channel,
|
|
254
|
+
team: `${tid}`,
|
|
255
|
+
},
|
|
256
|
+
});
|
|
257
|
+
await ctx.sleep(config.batchInterval);
|
|
258
|
+
}
|
|
259
|
+
return '';
|
|
260
|
+
}
|
|
243
261
|
if (!pw)
|
|
244
262
|
return config.informNotbind ? session.text('.notbind') : '';
|
|
245
263
|
if (!indices.length || indices.length % 2 !== 0)
|
|
@@ -319,6 +337,7 @@ exports.MahjongPub = MahjongPub;
|
|
|
319
337
|
MahjongPub.Config = koishi_1.Schema.object({
|
|
320
338
|
informNotbind: koishi_1.Schema.boolean().default(false),
|
|
321
339
|
endpoint: koishi_1.Schema.string().default('https://cdn.r-mj.com/'),
|
|
340
|
+
batchInterval: koishi_1.Schema.natural().default(500),
|
|
322
341
|
});
|
|
323
342
|
})(MahjongPub || (exports.MahjongPub = MahjongPub = {}));
|
|
324
343
|
exports.default = MahjongPub;
|
package/lib/locales/zh-CN.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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":"参数错误","success":"- [{cid}:{tid}] {name}\n{players.map((p, i) => '' + (i+1) + ': ' + p).join('\\n')}\n"}},"mahjongpub.contest.bind":{"description":"绑定比赛","messages":{"failed":"绑定失败","success":"成功: [{cid}] {name}"}}}}
|
|
1
|
+
{"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}"}}}}
|