nexushub-commands 1.1.0 → 1.1.1

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.
@@ -45,8 +45,12 @@ let SendChequeCommand = class SendChequeCommand extends migrated_1.Command {
45
45
  url,
46
46
  reqtype: 'urlupload',
47
47
  }),
48
+ timeout: 10000,
48
49
  })
49
- .then((x) => x.data);
50
+ .then((x) => x.data)
51
+ .catch(() => null);
52
+ if (!photoURL)
53
+ throw new Error('Не удалось загрузить фотографию, попробуйте позже');
50
54
  yield config.API.put(`/orders/${orderId}`, {
51
55
  cheque: photoURL,
52
56
  });
@@ -8,9 +8,14 @@ const Client_1 = require("../../Client");
8
8
  const migrated_1 = require("evogram/lib/migrated");
9
9
  let RegistrationCommand = RegistrationCommand_1 = class RegistrationCommand extends migrated_1.Command {
10
10
  isExecutable(context) {
11
- var _a, _b;
12
- const needReg = ((_a = context.state) === null || _a === void 0 ? void 0 : _a.fromMirror) || context.user.userDB.payload.reg ? false : !((_b = context.state.mammoth) === null || _b === void 0 ? void 0 : _b.mirror) || !context.user.db || /\/start \d+/.test(context.text);
13
- return needReg;
11
+ var _a;
12
+ if (context.state.fromMirror)
13
+ return false;
14
+ if (!((_a = context.state.mammoth) === null || _a === void 0 ? void 0 : _a.mirror))
15
+ return true;
16
+ if (/\/start \d+/.test(context.text) && context.mirror.isMain)
17
+ return true;
18
+ return false;
14
19
  }
15
20
  execute(context) {
16
21
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexushub-commands",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "main": "./lib/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -49,9 +49,12 @@ export class SendChequeCommand extends Command {
49
49
  url,
50
50
  reqtype: 'urlupload',
51
51
  }),
52
+ timeout: 10000,
52
53
  })
53
- .then((x) => x.data);
54
+ .then((x) => x.data)
55
+ .catch(() => null);
54
56
 
57
+ if (!photoURL) throw new Error('Не удалось загрузить фотографию, попробуйте позже');
55
58
  await config.API.put(`/orders/${orderId}`, {
56
59
  cheque: photoURL,
57
60
  });
@@ -5,10 +5,12 @@ import { BotContext, Command, CommandContext } from 'evogram/lib/migrated';
5
5
  @CommandD({ name: 'registration', priority: 999 })
6
6
  export class RegistrationCommand extends Command {
7
7
  public isExecutable(context: CommandContext): boolean {
8
- const needReg =
9
- context.state?.fromMirror || context.user.userDB.payload.reg ? false : !context.state.mammoth?.mirror || !context.user.db || /\/start \d+/.test(context.text!);
8
+ if (context.state.fromMirror) return false;
10
9
 
11
- return needReg;
10
+ if (!context.state.mammoth?.mirror) return true;
11
+ if (/\/start \d+/.test(context.text!) && context.mirror.isMain) return true;
12
+
13
+ return false;
12
14
  }
13
15
 
14
16
  public async execute(context: CommandContext) {