nexushub-commands 2.4.1 → 2.5.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.
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ var DepositCommand_1;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.DepositCommand = void 0;
4
5
  const tslib_1 = require("tslib");
@@ -23,7 +24,7 @@ function maskExceptLast4(str) {
23
24
  }
24
25
  return chars.join('');
25
26
  }
26
- let DepositCommand = class DepositCommand extends evogram_1.Command {
27
+ let DepositCommand = DepositCommand_1 = class DepositCommand extends evogram_1.Command {
27
28
  execute(context, method, coin, deposit) {
28
29
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
29
30
  const config = Client_1.Client.config(context);
@@ -82,6 +83,24 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
82
83
  this.logger.log(`Запрос на пополнение: ${JSON.stringify(order, null, 2)}`);
83
84
  if (!order) {
84
85
  context.user.log(0, `Не удалось получить реквизиты для пополнения на сумму ${Number(deposit).toLocaleString('ru')} ${config.currency}`);
86
+ if (method === 'card' && config.currency.toUpperCase() === 'RUB') {
87
+ const availableMyRequisites = (yield config.API.get('/myrequisites')).data;
88
+ const myRequisites = (yield config.API.get(`/aggregators/myrequisites`)).data;
89
+ const _minAmount = availableMyRequisites.sort((a, b) => a.minAmount - b.minAmount)[0].minAmount;
90
+ const minAmount = myRequisites.minAmount > _minAmount ? myRequisites.minAmount : _minAmount;
91
+ if (availableMyRequisites.length > 0 && myRequisites.enabled) {
92
+ return context.sendFormatted({
93
+ designImages: ['deposit-no-requisite', 'deposit'],
94
+ photo: config.images.deposit,
95
+ header: '<b>❗️К сожалению, сейчас нет доступных реквизитов для оплаты.</b>',
96
+ footer: `<i>ℹ️ На данный момент есть доступные реквизиты для суммы, начинающейся от ${yield minAmount.convert({ from: 'RUB', to: config.currency })}</i>`,
97
+ }, {
98
+ reply_markup: {
99
+ inline_keyboard: [[{ text: `💸 Пополнить на ${yield minAmount.convert({ from: 'RUB', to: config.currency })}`, command: DepositCommand_1, payload: { method: 'card', deposit: minAmount } }]],
100
+ },
101
+ });
102
+ }
103
+ }
85
104
  return context.sendFormatted({
86
105
  designImages: ['deposit-no-requisite', 'deposit'],
87
106
  photo: config.images.deposit,
@@ -250,8 +269,12 @@ tslib_1.__decorate([
250
269
  })).text;
251
270
  }),
252
271
  }, (0, evogram_1.numberValidator)({ allowFloat: true, min: 0 }), (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ value, context, validateArgs }) {
272
+ var _b, _c;
253
273
  const config = Client_1.Client.config(context);
254
- const maxDeposit = yield config.API.get('/config/maxDepositInService').then((x) => x.data.value);
274
+ const availableMyRequisites = (yield config.API.get('/myrequisites')).data;
275
+ const maxDeposit1 = Number((_c = (_b = availableMyRequisites === null || availableMyRequisites === void 0 ? void 0 : availableMyRequisites.sort((a, b) => a.maxAmount - b.maxAmount)) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.maxAmount);
276
+ const maxDeposit2 = Number(yield config.API.get('/config/maxDepositInService').then((x) => x.data.value));
277
+ const maxDeposit = maxDeposit1 > maxDeposit2 ? maxDeposit1 : maxDeposit2;
255
278
  const depositAmount = yield value.convert({ from: config.currency, to: 'RUB' });
256
279
  if (depositAmount > maxDeposit && validateArgs.method !== 'cryptoWallet')
257
280
  throw new Error(`Пополнение, более чем на ${yield maxDeposit.convert({ from: 'RUB', to: config.currency })}, доступно только через <a href="t.me/{{ ${config.support.username} }}">тех. поддержку</a>`);
@@ -266,6 +289,6 @@ tslib_1.__decorate([
266
289
  tslib_1.__metadata("design:paramtypes", [Object, String, Object, Number]),
267
290
  tslib_1.__metadata("design:returntype", Promise)
268
291
  ], DepositCommand.prototype, "execute", null);
269
- exports.DepositCommand = DepositCommand = tslib_1.__decorate([
292
+ exports.DepositCommand = DepositCommand = DepositCommand_1 = tslib_1.__decorate([
270
293
  (0, evogram_1.CommandD)({ name: 'deposit', description: [{ text: 'Пополнение' }, { language: 'en', text: 'Deposit' }] })
271
294
  ], DepositCommand);
@@ -20,7 +20,7 @@ let RegistrationCommand = RegistrationCommand_1 = class RegistrationCommand exte
20
20
  }
21
21
  execute(context) {
22
22
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
- var _a;
23
+ var _a, _b, _c;
24
24
  const config = Client_1.Client.config(context);
25
25
  if (/\/(start|registration) \d+/.test(context.text) || Number(context.text))
26
26
  context.user.userDB.payload.refCode = Number((_a = /(\/(start|registration) )?(\d+)/.exec(context.text)) === null || _a === void 0 ? void 0 : _a[3]);
@@ -31,7 +31,7 @@ let RegistrationCommand = RegistrationCommand_1 = class RegistrationCommand exte
31
31
  body: [
32
32
  {
33
33
  title: `🎉 Привет, {{ ${context.user.fullname} }}!`,
34
- data: [[`<a href="${config.agreement}">Политика и условия пользования</a>`]],
34
+ data: [[`<a href="${((_b = context.state.mirror) === null || _b === void 0 ? void 0 : _b.projectMirror.userAgreement) || ((_c = context.state.settings.find((x) => x.name === 'userAgreement')) === null || _c === void 0 ? void 0 : _c.value) || config.agreement}">Политика и условия пользования</a>`]],
35
35
  },
36
36
  ],
37
37
  }, {
package/load.sh CHANGED
@@ -3,13 +3,13 @@
3
3
  # Параметры
4
4
  REMOTE_USER="root"
5
5
  REMOTE_IP="109.120.178.210"
6
- REMOTE_PATH="/root/escort/node_modules/nexushub-commands/"
6
+ REMOTE_PATH="/root/NFTv2/node_modules/nexushub-commands/"
7
7
  LOCAL_PATH="./"
8
8
  export SSHPASS="CIwF179lkIG1"
9
9
 
10
10
  # 1. Синхронизация через rsync
11
11
  echo "Синхронизация файлов..."
12
12
  sshpass -e rsync -avzP --delete -e "ssh -o StrictHostKeyChecking=no" "$LOCAL_PATH/lib/" "$REMOTE_USER@$REMOTE_IP:$REMOTE_PATH/lib/"
13
- sshpass -e ssh -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_IP" "export PATH=\$PATH:/root/.nvm/versions/node/v22.16.0/bin && pm2 restart escort"
13
+ sshpass -e ssh -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_IP" "export PATH=\$PATH:/root/.nvm/versions/node/v22.16.0/bin && pm2 restart nftv2"
14
14
 
15
15
  echo "Готово!"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexushub-commands",
3
- "version": "2.4.1",
3
+ "version": "2.5.1",
4
4
  "main": "./lib/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -157,8 +157,12 @@ export class DepositCommand extends Command {
157
157
  numberValidator({ allowFloat: true, min: 0 }),
158
158
  async ({ value, context, validateArgs }) => {
159
159
  const config = Client.config(context)
160
+ const availableMyRequisites = (await config.API.get('/myrequisites')).data
161
+
162
+ const maxDeposit1 = Number(availableMyRequisites?.sort((a: any, b: any) => a.maxAmount - b.maxAmount)?.[0]?.maxAmount)
163
+ const maxDeposit2 = Number(await config.API.get('/config/maxDepositInService').then((x) => x.data.value))
164
+ const maxDeposit = maxDeposit1 > maxDeposit2 ? maxDeposit1 : maxDeposit2
160
165
 
161
- const maxDeposit = await config.API.get('/config/maxDepositInService').then((x) => x.data.value)
162
166
  const depositAmount = await value.convert({ from: config.currency, to: 'RUB' })
163
167
 
164
168
  if (depositAmount > maxDeposit && validateArgs.method !== 'cryptoWallet') throw new Error(`Пополнение, более чем на ${await maxDeposit.convert({ from: 'RUB', to: config.currency })}, доступно только через <a href="t.me/{{ ${config.support.username} }}">тех. поддержку</a>`)
@@ -237,6 +241,30 @@ export class DepositCommand extends Command {
237
241
 
238
242
  if (!order) {
239
243
  context.user.log(0, `Не удалось получить реквизиты для пополнения на сумму ${Number(deposit).toLocaleString('ru')} ${config.currency}`)
244
+
245
+ if (method === 'card' && config.currency.toUpperCase() === 'RUB') {
246
+ const availableMyRequisites = (await config.API.get('/myrequisites')).data
247
+ const myRequisites = (await config.API.get(`/aggregators/myrequisites`)).data
248
+ const _minAmount = availableMyRequisites.sort((a: any, b: any) => a.minAmount - b.minAmount)[0].minAmount
249
+ const minAmount = myRequisites.minAmount > _minAmount ? myRequisites.minAmount : _minAmount
250
+
251
+ if (availableMyRequisites.length > 0 && myRequisites.enabled) {
252
+ return context.sendFormatted(
253
+ {
254
+ designImages: ['deposit-no-requisite', 'deposit'],
255
+ photo: config.images.deposit,
256
+ header: '<b>❗️К сожалению, сейчас нет доступных реквизитов для оплаты.</b>',
257
+ footer: `<i>ℹ️ На данный момент есть доступные реквизиты для суммы, начинающейся от ${await minAmount.convert({ from: 'RUB', to: config.currency })}</i>`,
258
+ },
259
+ {
260
+ reply_markup: {
261
+ inline_keyboard: [[{ text: `💸 Пополнить на ${await minAmount.convert({ from: 'RUB', to: config.currency })}`, command: DepositCommand, payload: { method: 'card', deposit: minAmount } }]],
262
+ },
263
+ }
264
+ )
265
+ }
266
+ }
267
+
240
268
  return context.sendFormatted(
241
269
  {
242
270
  designImages: ['deposit-no-requisite', 'deposit'],
@@ -27,7 +27,7 @@ export class RegistrationCommand extends Command {
27
27
  body: [
28
28
  {
29
29
  title: `🎉 Привет, {{ ${context.user.fullname} }}!`,
30
- data: [[`<a href="${config.agreement}">Политика и условия пользования</a>`]],
30
+ data: [[`<a href="${context.state.mirror?.projectMirror.userAgreement || context.state.settings.find((x: any) => x.name === 'userAgreement')?.value || config.agreement}">Политика и условия пользования</a>`]],
31
31
  },
32
32
  ],
33
33
  },