@hieuzest/koishi-plugin-mahjongpub 0.1.3 → 0.1.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.
Files changed (2) hide show
  1. package/lib/index.js +6 -1
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -20,6 +20,7 @@ class MahjongPub {
20
20
  });
21
21
  ctx.command('mahjongpub.team.bind <pw:string>')
22
22
  .alias('!绑定', '!绑定')
23
+ .option('user', '-u <user:user>')
23
24
  .option('channel', '-c <channel:channel>')
24
25
  .userFields(['mahjongpub/bind-team'])
25
26
  .channelFields(['mahjongpub/bind-team'])
@@ -34,7 +35,9 @@ class MahjongPub {
34
35
  ctx.logger.warn(e);
35
36
  return session.text('.failed');
36
37
  }
37
- if (options.channel)
38
+ if (options.user)
39
+ ctx.database.setUser(...parsePlatform(options.user), { 'mahjongpub/bind-team': pw });
40
+ else if (options.channel)
38
41
  ctx.database.setChannel(...parsePlatform(options.channel), { 'mahjongpub/bind-team': pw });
39
42
  else if (session.isDirect)
40
43
  session.user['mahjongpub/bind-team'] = pw;
@@ -75,6 +78,8 @@ class MahjongPub {
75
78
  .action(async ({ session, options }) => {
76
79
  const pw = options.channel ? (await session.getChannel(parsePlatform(options.channel)[1], ['mahjongpub/bind-team']))['mahjongpub/bind-team']
77
80
  : session.isDirect ? session.user['mahjongpub/bind-team'] : session.channel['mahjongpub/bind-team'];
81
+ if (!pw)
82
+ return config.informNotbind ? session.text('.notbind') : '';
78
83
  const team = new api_1.Team(ctx, pw, config);
79
84
  try {
80
85
  await team.read();
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.3",
4
+ "version": "0.1.4",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [