nexushub-commands 1.1.0 → 1.1.2
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/commands/deposit/Deposit.command.js +2 -2
- package/lib/commands/deposit/SendCheque.command.js +5 -1
- package/lib/commands/registration/Registration.command.js +8 -3
- package/package.json +1 -1
- package/src/commands/deposit/Deposit.command.ts +2 -2
- package/src/commands/deposit/SendCheque.command.ts +4 -1
- package/src/commands/registration/Registration.command.ts +5 -3
|
@@ -169,7 +169,7 @@ tslib_1.__decorate([
|
|
|
169
169
|
const config = Client_1.Client.config(context);
|
|
170
170
|
let minAmountSetting = JSON.parse(context.state.settings.find((x) => x.name === 'minDeposit').value);
|
|
171
171
|
let minAmount = (_b = minAmountSetting[config.currency]) !== null && _b !== void 0 ? _b : (yield minAmountSetting['RUB'].convert({ from: 'RUB', to: config.currency }));
|
|
172
|
-
const minDepositByMethod = yield config.API.get('/config/minDepositByMethod').then((x) => x.data);
|
|
172
|
+
const minDepositByMethod = yield config.API.get('/config/minDepositByMethod').then((x) => x.data.value);
|
|
173
173
|
// prettier-ignore
|
|
174
174
|
if (minDepositByMethod && minDepositByMethod[args.method] !== undefined && (yield minAmount.convert({ from: config.currency, to: 'RUB' })) < minDepositByMethod[args.method])
|
|
175
175
|
minAmount = yield minDepositByMethod[args.method].convert({ from: 'RUB', to: config.currency });
|
|
@@ -190,7 +190,7 @@ tslib_1.__decorate([
|
|
|
190
190
|
if (args.method === 'cryptoWallet')
|
|
191
191
|
return 0;
|
|
192
192
|
const config = Client_1.Client.config(context);
|
|
193
|
-
const maxDeposit = yield config.API.get('/config/maxDepositInService').then((x) => x.data);
|
|
193
|
+
const maxDeposit = yield config.API.get('/config/maxDepositInService').then((x) => x.data.value);
|
|
194
194
|
const depositAmount = yield value.convert({ from: config.currency, to: 'RUB' });
|
|
195
195
|
if (depositAmount > maxDeposit)
|
|
196
196
|
throw new Error(`Пополнение, более чем на ${yield maxDeposit.convert({ from: 'RUB', to: config.currency })}, доступно только через <a href="t.me/{{ ${config.support.username} }}">тех. поддержку</a>`);
|
|
@@ -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
|
|
12
|
-
|
|
13
|
-
|
|
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
|
@@ -96,7 +96,7 @@ export class DepositCommand extends Command {
|
|
|
96
96
|
let minAmountSetting = JSON.parse(context.state.settings.find((x: any) => x.name === 'minDeposit').value);
|
|
97
97
|
let minAmount = minAmountSetting[config.currency] ?? (await minAmountSetting['RUB'].convert({ from: 'RUB', to: config.currency }));
|
|
98
98
|
|
|
99
|
-
const minDepositByMethod = await config.API.get('/config/minDepositByMethod').then((x) => x.data);
|
|
99
|
+
const minDepositByMethod = await config.API.get('/config/minDepositByMethod').then((x) => x.data.value);
|
|
100
100
|
// prettier-ignore
|
|
101
101
|
if (minDepositByMethod && minDepositByMethod[args.method] !== undefined && (await minAmount.convert({ from: config.currency, to: 'RUB' })) < minDepositByMethod[args.method])
|
|
102
102
|
minAmount = await minDepositByMethod[args.method].convert({ from: 'RUB', to: config.currency });
|
|
@@ -122,7 +122,7 @@ export class DepositCommand extends Command {
|
|
|
122
122
|
if (args.method === 'cryptoWallet') return 0;
|
|
123
123
|
const config = Client.config(context);
|
|
124
124
|
|
|
125
|
-
const maxDeposit = await config.API.get('/config/maxDepositInService').then((x) => x.data);
|
|
125
|
+
const maxDeposit = await config.API.get('/config/maxDepositInService').then((x) => x.data.value);
|
|
126
126
|
const depositAmount = await value.convert({ from: config.currency, to: 'RUB' });
|
|
127
127
|
|
|
128
128
|
if (depositAmount > maxDeposit)
|
|
@@ -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
|
-
|
|
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
|
|
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) {
|